Skip to main content

Round robin lead assignment for API generated leads in Zoho CRM

Do you add leads to your CRM via the Zoho CRM API? If so, you'll note that lead assignment rules don't work. I have developed a CRM extension called Advanced Round Robin that you can buy on the Zoho Marketplace. If you'd prefer to do it yourself, the below code can allow you to add round robin lead assignment functionality (though it's missing many of the more powerful features of the Advanced Round Robin extension). You'll need to set a few config variables like your authtoken and the user role you want leads to be assigned to. You'll also need to create a reference lead that's assigned to one of the users who should receive leads. The script will use this to figure out who should get the next lead. Thanks to Prakash from Zoho for giving me the base code for this script.


Want more options? I have a paid version of this script that you can buy on the Zoho Marketplace.

Comments

  1. Hey, I am trying to apply this but when you say Authorization Token, what are you referring to? I am pretty new to this. Sorry!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi, is this code intended for custom functions in ZOHO? As this seems to fail when trying to save and execute (variable leadid is not defined): https://i.imgur.com/vqcGG7b.png

    ReplyDelete
  4. I now found to update the function and make it work manually (filling out the field with a test lead number), but when adding it to a workflow assignment - it seems the update doesn't work anymore -

    ReplyDelete
  5. You need to make leadid an argument to the custom function.

    ReplyDelete
  6. Yes just look at the XML response from the getUsers API call and figure out the xml path needed to retrieve the group name.

    ReplyDelete
    Replies
    1. @jeremy, Each user can be in multiple groups. It may be a way to get Users from a group?

      Delete
    2. @Expert Learner: I have a paid version of the round robin extension and your use case is technically possible with that. https://marketplace.zoho.com/crm/advanced-round-robin-extension

      Delete
  7. @Nathaniel, also would like to use groups. Did you get it to work?

    ReplyDelete

Post a Comment

Popular posts from this blog

Getting current time in a specified timezone using Deluge script

Recently I was working on a custom function for Zoho CRM which required me to get the current time in a specified timezone. I assumed that zoho.currenttime would give me the time based on the timezone chosen in the organisation settings but discovered that it always gives it to you in PST. The Zoho Partner team gave me this snippet to solve the problem: current_time_in_timezone = zoho.currenttime.toString("yyyy-MM-dd'T'HH:mm:ss", "Australia/Sydney").toTime("yyyy-MM-dd'T'HH:mm:ss"); If you need the current date, do: current_date_in_timezone = zoho.currenttime.toString("yyyy-MM-dd'T'HH:mm:ss", timezone).toDate(); To figure out what you can put in for the timezone part, refer to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

searchRecords with multiple criteria in Zoho CRM API

NB: this blog post is no longer relevant as API v2 lets you use searchRecords with multiple criteria :) I discovered something really cool tucked away in the Zoho CRM forums today. For the history, check out this thread . In summary, the searchRecords API task in Zoho CRM is impossible to use if you have multiple criteria and in general it's pretty annoying to get the single criterion right. In the forum thread, Zoho Support advised that you can actually use getRecords with a view name. This feature is not documented on the getRecords page at all but I can confirm it works:D This is really, really cool. It's going to make my life as a Zoho dev much easier! Instead of having to do something really inefficient and ugly like: leadRecords = zoho.crm.searchRecords("Leads","(Created Time|<|" + yesterday_date +")",fromIndex,toIndex); for each ele in leadRecords { lead_source = ele.get("Lead Source"); createTime=(ele.g

Debugging Deluge script in Zoho Creator/Zoho CRM

Deluge is a powerful language that simplifies a ton of things, e.g. database lookups. But I have to say, it's very painful to debug. Interpreting longish scripts takes ages, error messages are obtuse if they exist at all and even the hints in the IDE don't always help (ever tried using containsIgnoreCase based on the auto-complete suggestion?). Here are my tips for debugging code when it's not working. 1. Split your code up into small custom functions. Nothing's more painful than waiting 30 seconds for a really long (say 1000 lines) HTML page to save and only then get feedback on a syntax error. I've got a few apps that are like this and it's not fun to work with at all. I haven't seen any improvements in the compile speed over the last few years, so my conclusion is that it's always best to write most of your logic code as small custom functions and then build that up in the HTML page so that you'll get quick feedback on syntax errors. 2. If