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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgofx3YzQy73k2UqCcbQBfBqYQxWqkdCYqRfS4xCBHD-PBCxb-jmvlksZFydSx2BqPqP5_ul66_yNtVA47pWXZnx5y01HnynCaWOlgvD4v1EePchot8-5EVbczEme14qrvOt-dD5mSkNXiM/s400/RR.jpg)
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:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJnh-VdVECvnwNYd8Q6SzYYLzCBr0C9heYD74otsc4MX-5LbeDLQ8sY2mdIdC-x02ieFnJ6T1u7-7tRP2FeOq5WIeuRaduELzuoSQXv5N8BP6lfhwVKKBv4EsK2dvvkNzQ18u9c0k3v3pZ/s400/Workflow.jpg)
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.