Optimal Utilization of Custom Functions and APIs - Online Help | Zoho Desk

Optimal Utilization of Custom Functions and APIs

 
Developers can enhance the performance of software applications by writing code efficiently. In Zoho Desk, when integrating or customizing the Desk account, developers can minimize the frequency of API calls and redundancy in code by following the guidelines below.  

Optimizing code in custom functions

It is advisable to optimize code by verifying if the necessary data has already been fetched rather than rewriting code to fetch the data again. Always verify the value of the field before executing any operation. This approach helps eliminate redundancy in the code.

Perform a null check of the fields before any operation

When making API calls or function calls, it is crucial to check for null values consistently. It is considered a best practice to ensure the existence of a value in optional or relevant fields before carrying out any operations associated with those fields.
For instance, it is advisable to check if the custom field cf_category has a value or not before executing the code or updating the field.



Ensure data availability before any operation

 When making an API call, it is advisable to check the details of the retrieved results before fetching related or identical data. 
For instance, if the ticketList API is called and it includes both ticketId and ticketNumber, it is recommended to utilize the ticketNumber data already present in the ticketList when fetching the ticketNumber using a function.


Use the include option in API calls

Instead of making two separate API calls to retrieve ticket details like ticketOwner and assignee information, a more efficient approach would be to use a single API call with the include option. This option allows users to fetch the necessary additional details in a single API call instead of making multiple calls. Learn more about include options.


Check data values before any operation

Avoiding unnecessary modifications to records helps ensure efficiency.
For instance, if you wish to mark a ticket as closed, verify whether the ticket is already closed or not

Utilize the sendReply option for email threads

The limit for sending emails is 2,500 per day. When using the sendmail function, the emails sent will not be logged in the ticket thread. However, you can use the sendReply function without any limits for sending emails, and the emails will be recorded in the thread conversation.



Avoid unnecessary automation with feature flags

If necessary, automation can be bypassed. In the case of a ticket update, if an automation workflow is created, the automation engine will be activated whenever there is an update in the ticket. To prevent this, configure the featureFlag to skip the automation.

Retrieve field values directly from arguments

Instead of fetching a field value through a function or in code, it is possible to obtain it using arguments.
For example, if you want to get the value of a field in the variable splitTicket, you can directly use the arguments. The variable already contains the field value, so there is no need to fetch the ticketId and then retrieve the value for the variable.


Optimizing API calls

 Using a single API call to obtain the necessary data and execute or modify an action is a more effective approach than utilizing multiple API calls.

Utilize a dedicated updateMany API to update multiple tickets

To efficiently update multiple tickets, use the updateMany API. This allows you to use a single API call rather than repeatedly updating each ticket using a loop and causing unnecessary network activity.
For instance, instead of retrieving a list of tickets and updating them one by one in a loop, using the updateMany API to update multiple tickets at once will minimize the number of API calls required.
        
                      

Use a single API request to modify multiple attributes of an entity

It's possible to update multiple properties of an entity with a single API call. 
For example, instead of making separate API calls to update a ticket's status and assigneeId  fields, a single API call can update both at once.
     
      

                 

Utilize a dedicated API for retrieving the most recent thread

Instead of retrieving the list of threads for a ticket and then fetching the latest thread separately, you can simply use the latestThread API to obtain the most recent thread details for that ticket.


                  


    Access your files securely from anywhere

      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

                                                                                                              • Working with API Dashboard

                                                                                                                API Dashboard The API dashboard is a visual interface that provides users a comprehensive view of API (Application Programming Interface) usage. This tool helps users track and analyze the API usage, providing insights about the services utilizing ...
                                                                                                              • Programming New Custom Functions

                                                                                                                Deluge, an abbreviation formed from - Data Enriched Language for the Universal Grid Environment is an online scripting language integrated with Zoho services. With this script, you can add different types of business logic to the custom functions. ...
                                                                                                              • Gallery Functions

                                                                                                                Zoho Desk offers you the following ready to deploy custom functions in Gallery: Create a task due in 3 days for every new ticket Update new and modified accounts from Desk to CRM Create CRM contacts for new tickets in Desk Create CRM accounts for new ...
                                                                                                              • Using Custom Function in Zoho Desk

                                                                                                                Custom functions are easy to program scripts, which helps you to update the data in related help desk modules or other third-party applications. When a record matches the workflow criteria, workflow engine automatically triggers the custom function ...
                                                                                                              • Encrypting Custom Help Desk Fields

                                                                                                                Just as we lock our money and restrict access to our property in the physical world, we must secure our personal information that is held by businesses and government agencies. We need a virtual lock that prevents identity thieves from stealing our ...
                                                                                                                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