Method 1: Code
I'm not much of a coder so I figured I'd try to achieve it without using plugins or jscript
Method 2: The cheeky use of entities to store values
To keep track of who we last sent a lead to, we're going to create a new entity and create a record for the variable storage. Let's call the entity 'RoundRobin'. We have a few options here.
- We could use the ownership relationship to store the next user to receive a lead
- We could set up a new N:1 relationship to the user entity
- We could add an attribute and store a value there
In my case I've set up an attribute.
I've also set up a 1:N relationship to Leads (they're called Enquiries here but they are just renamed Leads, I promise).
Now the tricky bit, the workflow. The steps of the workflow are:
- Link the lead to your one RoundRobin record
- If the attribute is 'a', assign the Lead to User1 and update the attribute to 'b' (in the case of using a relationship to the users, simply reassign it)
- If the attribute is 'b', assign the Lead to User2 and update the attribute to 'a'
Here is one I prepared earlier:
In this case I have it as On Demand but with workflows being asynchronous, this tends to act a little weird (basically a bunch of Leads get assigned before the attribute has a chance to change). However, if you run it on the creation of the lead, it works fine assuming there is a reasonable time between lead creations.