Automatically distribute incoming leads evenly across your sales team using a round-robin algorithm stored in a custom module.
When scaling a sales team, manually assigning incoming leads quickly becomes a bottleneck. Sales reps complain about unfair distribution, and response times plummet while leads sit in an unassigned queue.
Standard workflow assignment rules in Zoho CRM are great, but they often lack the true dynamic "Round Robin" capability where you simply cycle through a list of available agents endlessly.
This blueprint relies on a very simple architecture:
Current_Index. This acts as our persistent memory counter.users list in the script.if(userIndex + 1 >= users.size(), 0, ...)) ensures the index loops back to zero automatically when it hits the end of the list.Current_Index. Create exactly ONE record in this module and note its ID.123456789 ID in the script below with your Settings record ID.users list with the actual emails of your sales team.// Get the next user in line
userIndex = zoho.crm.getRecordById("Settings", 123456789).get("Current_Index");
users = {"user1@domain.com", "user2@domain.com", "user3@domain.com"};
// Assign lead
nextUser = users.get(userIndex);
zoho.crm.updateRecord("Leads", leadId, {"Owner": nextUser});
// Update index
newIndex = if(userIndex + 1 >= users.size(), 0, userIndex + 1);
zoho.crm.updateRecord("Settings", 123456789, {"Current_Index": newIndex});