Function-2: Round-Robin assignment of records

Function-2: Round-Robin assignment of records


Welcome back folks!

Last week, we saw how to update sales commission in quotes using a custom function. This week, let's see an interesting use case asked by many of you - auto-assignment records by round-robin method.

Business scenario:

Right now, the solution allows you to auto-assign leads from web form and imported lists. Let us look at a need where you want to auto-assign leads from in-bound calls in a round-robin method, across modules.

Prerequisite: You must create a permanent record in the specific module, leads in this case and assign that record to the first user in round-robin.

Here’s how you add this custom function to your CRM account:
  • Go to Setup>Automations>Actions >Custom Functions > Configure Custom Function > Write your own.
  • Enter the name of the Custom function. For example: “Round-robin assignment”.
  • Select the module as Quotes. Add a description(optional).
  • Click “Free flow scripting”.
  • Copy the code given below.
  • Click “Edit arguments”.
  • Enter the name as “leadId” and select the value as “Lead Id”.
  • Click Save.

As you have created a permanent record, this function does the assignment on a round-robin basis without errors. Note that the function won’t work if you don’t create a permanent record .

The script:

Code for Version 2.0 API:
 
firstRefRecordDetails = zoho.crm.getRecordById("Leads", xxxxxxxxxxxxx);
firstOwner = ifnull(firstRefRecordDetails.get("Owner"),"").get("id");
if (firstOwner = "User_ID_1")
{
UpOwner = "User_ID_2";
}
if (firstOwner = "User_ID_2")
{
UpOwner = "User_ID_1";
}
updatefirstRef = zoho.crm.update("Leads", "xxxxxxxxxxx".toLong(), { "Owner" : UpOwner.toLong() });
info updatefirstRef;
mp = map();
mp.put("Owner", UpOwner.toLong());
updateResp = zoho.crm.update("Leads", leadId.toLong(), mp);
info mp;
info updateResp;


Code for Version 1.0 API:

leadIdStr = input.leadId.toString();
firstRefRecordDetails = zoho.crm.getRecordById("Leads", xxxxxxxxxxxxx);
firstOwner = ifnull(firstRefRecordDetails.get("SMOWNERID"),"");
if (firstOwner = "User_ID_1")
{
UpOwner = "User_ID_2";
}
if (firstOwner = "User_ID_2")
{
UpOwner = "User_ID_1";
}
updatefirstRef = zoho.crm.updateRecord("Leads", "xxxxxxxxxxx", { "SMOWNERID" : UpOwner });
mp = map();
mp.put("SMOWNERID", UpOwner);
updateResp = zoho.crm.updateRecord("Leads", leadIdStr, mp);
info mp;
info updateResp;

—————————————————————————————————————————

Note:
  • Replace 'xxxxxxxxxx' with the permanent record id mentioned in the pre-requisite.
  • The above code is an example for assigning the records in the Leads module. You can use this code for any other module by changing the module name and parameters. 
  • Assigning to a user requires the User ID and not the user name. The user ID is found in the Setup page of your CRM. Take a look at the screenshot below for more details.


Do try this out and let me know how it worked. If you have questions, ask away. Share this with your team if you think they'll find this useful. See you all next week with another interesting custom function in this series. Until then !

Update: As you must be aware, API V1.0 will be deprecated and support for version 1.0 API will be available only till Dec 31, 2018. Version 1.0 compatible Functions will continue to work until Dec 31, 2019. You're advised to migrated to API Version 2.0 at the earliest. Check this announcement for more. We've updated the post to include the Version 2.0 compatible Function.

    Access your files securely from anywhere


            Zoho Developer Community




                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day



                                          Zoho Marketing Automation
                                                  • Sticky Posts

                                                  • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

                                                    Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
                                                  • Custom Function : Automatically send the Quote to the related contact

                                                    Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
                                                  • Function #50: Schedule Calls to records

                                                    Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. Business scenario Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly. CRM
                                                  • Function #37: Create a Purchase Order from a Quote

                                                    Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,
                                                  • Function-2: Round-Robin assignment of records

                                                    Welcome back folks! Last week, we saw how to update sales commission in quotes using a custom function. This week, let's see an interesting use case asked by many of you - auto-assignment records by round-robin method. Business scenario: Right now, the solution allows you to auto-assign leads from web form and imported lists. Let us look at a need where you want to auto-assign leads from in-bound calls in a round-robin method, across modules. Prerequisite: You must create a permanent record in the


                                                  Manage your brands on social media



                                                        Zoho TeamInbox Resources

                                                          Zoho DataPrep Resources



                                                            Zoho CRM Plus Resources

                                                              Zoho Books Resources


                                                                Zoho Subscriptions Resources

                                                                  Zoho Projects Resources


                                                                    Zoho Sprints Resources


                                                                      Qntrl Resources


                                                                        Zoho Creator Resources



                                                                            Zoho CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

                                                                                    Writer is a powerful online word processor, designed for collaborative work.

                                                                                      Zoho CRM コンテンツ






                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方





                                                                                                  • Recent Topics

                                                                                                  • Directly Edit, Filter, and Sort Subforms on the Details Page

                                                                                                    Hello everyone, As you know, subforms allow you to associate multiple line items with a single record, greatly enhancing your data organization. For example, a sales order subform neatly lists all products, their quantities, amounts, and other relevant
                                                                                                  • Zoho One Backup of entire account

                                                                                                    Hello, When using Zoho one is there a way to backup your entire account of all apps that you are using \ activively using in a single step or do you have to backup each applications data individually? Thanks,
                                                                                                  • Custom Fonts in Zoho CRM Template Builder

                                                                                                    Hi, I am currently creating a new template for our quotes using the Zoho CRM template builder. However, I noticed that there is no option to add custom fonts to the template builder. It would greatly enhance the flexibility and branding capabilities if
                                                                                                  • Lookup filed, odd issue

                                                                                                    So I tried creating and app that has the names of engineers so I can use that for a lookup in the other apps that are being created . I add the look up in a new app, launch the app and when I try to fill out the form its just blank in the drop down menu
                                                                                                  • Unable to send message;Reason:550 5.4.6 Unusual sending activity detected. Please try after sometime

                                                                                                    Hello i'm unable to send any email because i keep getting this error Unable to send message;Reason:550 5.4.6 Unusual sending activity detected. Please try after sometime i have literally sent less than 10 emails today i'm not sure why i'm getting this
                                                                                                  • Cannot unblock IMAP for my account

                                                                                                    IMAP got block on my account for suspicious activity because I was testing different VPN servers in different locations. When I try to unblock it I get an error that says Sorry , we are unable to process your request, please contact support@zohomail.com.
                                                                                                  • Zoho Team Inbox down for several hours

                                                                                                    Error while processing the request! javax.mail.MessagingException: java.io.IOException: Problem communicating with the recipient server
                                                                                                  • ZOho Vault access denied

                                                                                                    Hello Community, I have suddenly got restricted by accessing Zoho vault . How can I get access back ?
                                                                                                  • Migration meines Accounts auf einen europäischen Server

                                                                                                    Hallo, wie kann ich meine Daten auf einen europäischen Server migrieren lassen? Ich habe hauptsächlich mit Kunden in Deutschland zu tun, die einen entsprechenden Datenschutz erfordern. VG, Kai
                                                                                                  • Restrict Payment Methods

                                                                                                    Allow us to restrict certain payment methods specific for each customer.
                                                                                                  • CHange timeformat in Tasks from 12 to 24 notation. Is that possible?

                                                                                                    Hi, I'm in the middel of the proces to possible migrate from Office365 tot ZOho. There are still some questions. One of them: How can I change the timeformat from 12 hour to 24 hour format? I can change it in my calendar settings, but it doesn't change
                                                                                                  • Power of Automation :: Trigger Automatic reminders to the task owners five days before the due date.

                                                                                                    Hello Everyone, A Custom Function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as to when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:-
                                                                                                  • Ability to use Rules to automatically "Exclude" transactions from Credit Card/Bank Statements

                                                                                                    Currently there is only the option to Categorize transactions based on rules, this request is to add "Exclude" to the rules so they could be automatically ignored based on the criteria.
                                                                                                  • Simplify Zoho API integration with Deluge’s invokeAPI task

                                                                                                    Hello all! Happy New Year! As we kick off 2025, we’re excited to share some of the latest updates to enhance your Deluge experience. While Deluge already offered robust API integration capabilities, we’ve taken it to the next level with the introduction
                                                                                                  • Support answers every 2 days

                                                                                                    I've tried to contact support via email, but they don't answer unless I call and complain. They still haven't solved my problem. Please reply.
                                                                                                  • How to authenticate my domain on ovh

                                                                                                    I don't succeed in adding an domain authentification on ovh. Should i first create a subdomain? But this doesn't work either, ti gi ves te same screen and the next button is greyed out when adding the info received from zoho
                                                                                                  • domain authentification on ovh and zoho

                                                                                                    I don't succeed in adding an domain authentification on ovh. Should i first create a subdomain? But this doesn't work either, ti gi ves te same screen and the next button is greyed out when adding the info received from zoho
                                                                                                  • How to Authenticate Heartland Footwear Email Domain

                                                                                                    Hi Zoho team! Can you give me a quick step(s) needed to Authenticate Heartland's email domain with Zoho? Thanks! :)
                                                                                                  • DKIM failed

                                                                                                    My zoho mail account couldn't be contacted.
                                                                                                  • Is there a list of Zoho Icons?

                                                                                                    Is there a list of Zoho Icons you can reference: i.e. business-gold is <image marginRight='7px' color='#2A70E7' bgColor='#FFFFFF' width='52px' height='52px' type='icon' value='business-gold' size='24px' cornerRadius='26px' iconType='solid' /> Thanks!
                                                                                                  • Unable to add organization consultants and contractors in Zoho People

                                                                                                    Hello Team: I am unable to add my few consultants and contractors in Zoho People. How to add these people as Users?
                                                                                                  • Bank Feeds Breaking Constantly

                                                                                                    Hey Everyone, I have already reached out to support about this issue but I am wondering if anyone else is having the same issue. My bank feeds keep breaking within days of me fixing them by updating the credentials. Its been happening for a while and
                                                                                                  • Custom module - change from autonumber to name

                                                                                                    I fear I know the answer to this already, but thought I'd ask the question. I created a custom module and instead of having a name as being the primary field, I changed it to an auto-number. I didn't realise that all searches would only show this reference.
                                                                                                  • Regarding Zoho flow trigger when zoho table record update

                                                                                                    So I'm setting up automation to sync between Zoho CRM and Tables using zoho flow now I setup trigger when I update record in zoho tables and test it and in payload I got object of ids like key is id of each colum and that's fine but main problem is I'm
                                                                                                  • Justworks

                                                                                                    We are in the process of moving from QB Online to Zoho Books. Our PEO service Justworks.com had an integrations with Quickbooks but, not Zoho Books which means we will have to manually enter payroll. Anyway to integrate?
                                                                                                  • Create custom rollup summary fields in Zoho CRM

                                                                                                    Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
                                                                                                  • How to apply customized Zoho Crm Home Page to all users?

                                                                                                    I have tried to study manuals and play with Zoho CRM but haven't found a way how to apply customized Zoho CRM Home Page as a (default) home page for other CRM users.. How that can be done, if possible? - kipi
                                                                                                  • Add option "Avoid custom home pages" to profiles

                                                                                                    We need our sales agents and members on each department in general to keep the same Home designed by their Managers. Let all users to create custom home pages is a huge mistake. The homepage creation must be limited by profile so only Managers are allowed to build the right home page for their subordinates.
                                                                                                  • Is it possible to set a value to a field based on certain conditions

                                                                                                    Greetings Say i have a field that i want to set its value based on the value of another field.. for example if "number" field has value greater than 10, i want to set my field's value to X. Or if radio group had option 1 selected, then i want to set my
                                                                                                  • Marketer's Space: Leveraging CRM Data for Dynamic Content and Personalized Campaigns

                                                                                                    Hello Marketers! Welcome back to another post in Marketer’s Space! We’re excited to continue our series on the many advantages of integrating Zoho CRM with Zoho Marketing Automation (ZMA). This series is designed to help you unlock the full potential
                                                                                                  • How can I understand in the search results which collection a note is in and how to immediately go to this collection?

                                                                                                    How can I understand in the search results which collection a note is in and how to immediately go to this collection? You can call the note properties window, but only the notepad is listed there. This is very inconvenient, especially when there are
                                                                                                  • restrict access to user to create invoice

                                                                                                    hi team we need to restrict particular users from accounts dept to create invoice directly from invoice module in zoho books . Rather , they can only able to create invoice is by using "convert to invoice" from "Sales Order" module . pls help us to solve
                                                                                                  • 各種書類のデータダウンロードについて(Excel形式)

                                                                                                    ZOHO CRM で見積書/受注書/請求書など、作成した書類データを1レコード分だけExcel(or csv)形式でダウンロードする方法はあるでしょうか? 設定→データ管理→エクスポートで抽出できるのは基本的にタブ単位で、任意のレコードのみを抽出できません。
                                                                                                  • Round-Robin with Load Based Assignment, can you limit which Status are considered?

                                                                                                    Hello, We are currently using Round-Robin with Load Base Assignment. Is there a way to exclude tickets of a certain Status from being considered by the Round-Robin Assignment rules? For example... I have the following statuses. Escalation Review (meaning
                                                                                                  • Introducing Zia LLM: Zoho’s in-house Generative AI solution for CRM's AI capabilities

                                                                                                    Hello everyone, We're excited to announce the launch of our in-house Large Language Model (LLM) by Zia to power our AI offerings. What is LLM? LLM stands for Large Language Model, a powerful AI technology that processes and generates human-like text based
                                                                                                  • CRM - Copy data from Single Line to Lookup Field

                                                                                                    Hello, I need help to create a workflow with a custom function in order to copy value from a single value field to a Lookup Field. Module : Shipment Single value field API name : Customer_ID Lookup field API name : Account_ID WOuld be great to have some
                                                                                                  • Notify on new comment

                                                                                                    I would like to notify users when a new comment is added to ticket/request?  So if someone is following request they would get email or text saying that comment has been added to this request. Or request/ticket owner get notified. Thanks Luis
                                                                                                  • How to customize the task reminder notification email

                                                                                                    HI guys,  I hope someone can help with this enquiry: We have included an additional/new field of information when an activity is assigned/created, however this new field is not part of body of the task reminder notification e-mail that is generated by
                                                                                                  • Using Zia in Zoho Sheet data to research the internet and return answer to a cell in Zoho Sheet

                                                                                                    I'm trying to see if Zia (connected with OpenAI key) can take data parameters stored in a Zoho Sheet to conduct research out on the internet then return an answer into the same Sheet. I'm trying to do the equivalent of using something like the =AI() function
                                                                                                  • Unattended Installer failure Error 1001

                                                                                                    I found by renaming the PC I was installing and trying again it work. This has happened several times when cloning and installing many pcs and forgetting to change the computer name before installing Zoho assist. Somehow I think the computer name is getting
                                                                                                  • Next Page