Custom Functions

Custom Functions

Custom functions are user built functions that help them to add new features to Zoho CRM as per their requirement. These are written in deluge script and are easy to construct. The syntax and logic are simple to formulate and aid in the continuous development of the code.

Custom functions liberate the user from a hard-coded CRM to a flexible one. They feel an actual control over the CRM which helps them find endless possibilities to make their work easier and faster. Some of the benefits of having custom functions are

  1. Achieve workflow automation by writing custom functions to control the flow. For example, automated lead assignment.
  2. Perform operations like Get, Put, Update or Delete data for any event happening in CRM. For example, sending the automated email to a customer whenever they are added to the system.
  3. Make extensions on the Zoho Developer Console and subsequently publishing them in the marketplace. Similarly, make connectors associated with the extensions to integrate the CRM with any third-party application.
The custom function finds its application in the following areas:
  1. Custom Buttons - Define your own button action by writing a custom function using Deluge script. Whenever the button is clicked, the associated custom function will be triggered.
  2. Custom Related Lists - Using a custom function, you can display related information associated with a particular record, in the record's details page.
  3. Connector and Connected Apps - You can write a custom function to enable the integration of Zoho CRM with a third party service using connectors and connected apps.
Examples

Automated Lead assignment

This function automatically assigns the leads to different users.
Saves a lot of time fot the admin and only does it to the active users, so that if any one of them is on vacation it skips that user and give it to the next in queue.
  1. lead_id = input.lead.get("Leads.ID");
  2. m = map();
  3. m.put("module", "Leads");
  4. datamap = {"id", lead_id.toLong()};
  5. m.put("data", datamap);
  6. resp = zoho.crm.invokeConnector("crm.get", m);
  7. lead_number = (resp.get("Lead_Number")).toLong();
  8. assignRule = resp.get("Assign_Using_Active_Assignment_Rule");
  9. UserDetail = zoho.crm.invokeConnector("crm.getusers",m);
  10. UserDetailtoMap = UserDetail.toMap();
  11. UserDetailtoMap2 = (UserDetailtoMap.get("users")).toMap();
  12. UserDetailtoList = UserDetailtoMap2.get("user").toJSONList();
  13. j = 0;
  14. valuez = map();
  15. for each index i in UserDetailtoList
  16. {
  17. fetchingDetail= (UserDetailtoList.get(i)).toMap();
  18. if (fetchingDetail.containKey("id"))
  19. {
  20. valuez.put(j.toString(), fetchingDetail.get("id"));
  21. j = j.toLong();
  22. j = (j + 1);
  23. }
  24. }
  25. max_lead_level1 = (i + 1);
  26. max_lead_level = (max_lead_level1).toLong();
  27. ans = (abs(((l_number - 1) % max_lead_level)) + 1);
  28. updateMap = map();
  29. updateMap.put("id", lead_id.toString());
  30. updateMap.put("Round_Robin_Id_Auto_Filled", ans);
  31. updateMap.put("Max_Lead_Level_Auto_Filled", max_lead_level);
  32. m1 = map();
  33. m1.put("module", "Leads");
  34. m1.put("data", updateMap);
  35. updatedResponse = zoho.crm.invokeConnector("crm.update", m1);
  36. info updatedResponse;
  37. if (assignRule == "true")
  38. {
  39. ans = (ans - 1);
  40. answ = ans.toString();
  41. ownerid = valuez.get(answ);
  42. mapp = map(); mapp.put("id", lead_id.toString());
  43. mapp.put("SMOWNERID", ownerid);
  44. newUpdateMap = map();
  45. newUpdateMap.put("module", "Leads");
  46. newUpdateMap.put("data", mapp);
  47. updatedResponse2 = zoho.crm.invokeConnector("crm.update", newUpdateMap);
  48. info updatedResponse2;
  49. }
  1. Fetch the lead id from the lead module
  2. Get all the related records for the same.
  3. Get Lead number
  4. Assign using active assignment method
  5. Get all the user information in the list after running the API from the plugin round-robin assignment.
  6. Then mapping a user to a lead as and when a new lead is generated.

Function to invoke connector task

  1. eventid = input.event.get("Events.ID");
  2. gtm_id = input.event.get("meeting.GoToMeetingId");
  3. mapp = { "meetingId" : gtm_id };
  4. respMap = zoho.crm.invokeConnector("meeting.connector_go_to_meeting.deletemeeting", mapp);
  5. info respMap;
  1. Event ID is being procured
  2. Goto meeting is being fetched from that particular event
  3. Mapping of dynamic values in connector
  4. Invoking connector and displaying response
Function to put the grand total amount from quote module and place it in the respective Potential module.
  1. quoteId = input.quote.get("Quotes.ID");   
  2. resp = zoho.crm.getRelatedRecords("Potentials", "Quotes", quoteId);   
  3. value = zoho.crm.getRecordById("Quotes", quoteId.toLong());   
  4. amount = value.get("Grand Total");    
  5. potential_amount = map();
  6. potentialId = value.get("Potentials.ID");
  7. potential_amount.put("id", potentialId);
  8. potential_amount.put("Amount", amount.toLong());
  9. potentialMap = map();
  10. potentialMap.put("module", "Potentials");
  11. potentialMap.put("data", potential_amount);
  12. updateResp = zoho.crm.invokeConnector("crm.update", potentialMap);
Get Quote id of the respective quote module
Get the information of the Potential related to that Quote.
Get all the related records corresponding to that Quote.
Extract the Potential ID.
Finally put the Potential name , Its ID and the amount quoted in Potential module.

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION








                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                        Manage your brands on social media

                                          Zoho Desk Resources

                                          • Desk Community Learning Series


                                          • Digest


                                          • Functions


                                          • Meetups


                                          • Kbase


                                          • Resources


                                          • Glossary


                                          • Desk Marketplace


                                          • MVP Corner


                                          • Word of the Day


                                            Zoho Marketing Automation

                                              Zoho Sheet Resources

                                               

                                                  Zoho Forms Resources


                                                    Secure your business
                                                    communication with Zoho Mail


                                                    Mail on the move with
                                                    Zoho Mail mobile application

                                                      Stay on top of your schedule
                                                      at all times


                                                      Carry your calendar with you
                                                      Anytime, anywhere




                                                            Zoho Sign Resources

                                                              Sign, Paperless!

                                                              Sign and send business documents on the go!

                                                              Get Started Now




                                                                      Zoho TeamInbox Resources



                                                                              Zoho DataPrep Resources



                                                                                Zoho DataPrep Demo

                                                                                Get a personalized demo or POC

                                                                                REGISTER NOW


                                                                                  Design. Discuss. Deliver.

                                                                                  Create visually engaging stories with Zoho Show.

                                                                                  Get Started Now









                                                                                                      • Related Articles

                                                                                                      • Custom Functions

                                                                                                        The guide will help you with the following: Create Custom Functions Program Custom Functions  Test Custom Functions  Associate with Workflow Rules  Manage Custom Functions  Custom functions help in automation where procedural logic is required, which ...
                                                                                                      • Functions

                                                                                                        This guide helps you with the following: Create Functions  Normal Functions REST API Functions Invoke Functions  Edit Functions  Delete Functions Rest API Functions Authentication Version 2.0 Version 1.0 Example Comparison of Version 2.0 and 1.0 ...
                                                                                                      • Automation - Setting up Custom Functions

                                                                                                        This guide will help you with the following: Create Custom Functions Program Custom Functions  Test Custom Functions  Associate with Workflow Rules  Manage Custom Functions  Custom functions help in automation where procedural logic is required, ...
                                                                                                      • Custom Actions

                                                                                                        This guide will help you with the following: Create Custom Actions  Associate with Workflow Rules  Manage Custom Actions  Zoho Developer provides various options to automate repetitive tasks and implement customizations that meet your business needs. ...
                                                                                                      • Client Functions

                                                                                                        This guide will help you with the following: 1. Hide | Show 2. Enable | Disable 3. Add | Append 4. Select | Deselect 5. SelectAll | DeselectAll 6. Clear items 7. Alert  8. Reload 1. Hide | Show Overview The hide deluge task hides a specified field on ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace

                                                                                                          Resources

                                                                                                          Videos

                                                                                                          Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                          eBooks

                                                                                                          Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                          Webinars

                                                                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                          CRM Tips

                                                                                                          Make the most of Zoho CRM with these useful tips.



                                                                                                            Zoho Show Resources