Mod Edit: 03-23-2022
Round robins are pretty popular with my clients and I'm sure many others - usually used to assign leads evenly across a team when creating deals/contacts in CRMs like Pipedrive, Salesforce, Hubspot etc.
While it's quite easy to create them using a lookup table in your zap, adding/removing/reordering means editing your zap each time which isn't ideal.
I set out to find an easy solution to this - and managed to build a round robin zap that can be managed directly from a Google Sheet.
It's starts with this template:
Round Robin Template Column B and C are obvious, and more could be added as needed.
Column A is the start of the magic - it marks that person's position in the RR using the formula "=ROW()-1"
Notice what happens if you move someone from below the black bar into the RR - the positions remain correct:
You'll also notice the count changes - this is achieved using another formula: "=COUNT(A2:A6)"
The extra blank black row acts a buffer - when you move rows up into that section they'll always fall inside the COUNT formula.
Over in our zap, we have leads coming in from Facebook.
Before building, you'll want to create a key/value pair in Zapier Storage to store an integer. Set it to 1 for now.
The second step in your zap should retrieve this:
The next step is to look up that row on the Google Sheet, searching in the 'Position' column:
With this person getting their lead (in Pipedrive in our example), we now need to increment that Storage value to keep the RR moving on:
Now, of course, with any further steps, this value would keep incrementing, eventually exceeding the number of people on the RR. We need some way to check this and reset the counter where needed.
So first, we want to go to the Google Sheet and retrieve that count number, so we know how many people are on the RR:
With that done, in comes a Javascript Code step (code below to copy/paste):
What this essentially does is compare the Storage value with the count on the Google Sheet. If it's equal or below (i.e no need to reset the counter) the word "go" is returned. If the Storage value has been incremented about the sheet count (i.e the counter needs resetting), we get "stop"
Next, we filter. And why, might you ask, couldn't we have compared the numbers directly in the filter step? Well, because we can't map values in there (P.S
So instead we filter on what word we got back.
And that brings us to the final step in our zap - one that will only run if the counter needs resetting - A Storage "Set Value" step that sets the number back to 1:
Done
I'd love to hear what people think!
var incriment = parseInt(inputData.incrimentStorage, 10);
var total = parseInt(inputData.totalSheet, 10);
if (incriment <= total) {
return {outcome: 'go'};
}
else if (incriment > total) {
return {outcome: 'stop'};
}
UPDATE: You can find details of alternative ways to set up Round Robins in your Zap here: Storage examples in Zaps > Round Robin