Best Practices for Platform Performance | Zoho Creator Help

Best Practices for Platform Performance

Zoho Creator is a platform where multiple solutions are available for a requirement. In some cases, one approach is better over others for better performance or for efficient results. In this article we will go through some practical considerations that might help you with the most optimal solution when there is more than one way to proceed.

Do's and Don'ts to Improve Performance

Requirement
Things to avoid
Recommended solution
Same column in multiple forms
Avoid adding additional fields for the same data.
Use relationships through lookup fields.
Comparison Operations
Avoid using the "contains" operator, as it involves extensive backend computation which may lead to performance issues. The "equals" built-in function is relatively better.
Use the "equalsIgnoreCase" built-in deluge function. 
Update multiple records
Avoid fetching all the records and iterating through the collection to update each column individually. Each of those updates is treated as a separate statement, which adds unnecessary overhead and can quickly use up the available statement count.
Use the Bulk Update Deluge task to update multiple fields using a single statement. 
Performing actions on a collection of records
Avoid fetching all the records, then iterating through them to perform actions or performing an IF check after fetching all the records.
Specify a criteria to fetch only the required records.

Using fields marked as "Mandatory" or "No Duplicate Values" in your criteria results in better performance. Similarly, using system fields such as Added Time or Modified Time can also help with improved performance.
Avoid looping through the records to extract field values and perform calculations.
Use aggregate functions directly in the fetch task. For example, the sum function can be used to calculate the total value while fetching the records, instead of performing calculations after the fetch.
Similarly, use getAll() to retrieve values as part of the fetch operation, rather than looping through the records separately to extract them.
Avoid using custom action buttons in reports when processing a large volume of records. Since this runs in live mode, it may impact application performance during regular usage.
Use the Schedules feature to execute such scripts during non-business hours instead.
Performing API calls
When a code block contains API scripts, the workflow waits for the API response before moving on to the next statement in the code block. If such API calls are triggered during a user action, it may cause visible delays for the user.
Schedule workflows with API calls during non-business hours.

Note: We are also developing an async task which allows the scripts to run without having to wait for a response. Track its release.
Avoid using APIs for operations where pre-defined Deluge tasks are available.
Use Deluge tasks and invoke a Function after it to handle any post-execution logic, instead of relying on API calls.
Calculations in Pages
Avoid performing calculations during instances where high user concurrency is likely in real-time, such as Page scripts which are triggered during events in a Page.
Move such calculations to a workflow, then simply display the computed values in Pages.
Calculations and concatenations for fields in the same form
Avoid performing calculations and concatenations through scripts when all the required fields are part of the same form.
Use a Formula field instead. Since the calculation is handled within the form during data entry, it is more efficient than submitting the form, then fetching the same record to compute and assign values separately, which adds unnecessary overhead.
Configuring Schedules to update records
For form-based schedules that are triggered based on fields such as "Added Time", avoid updating all records in the form. When multiple users add records simultaneously, or when importing data, multiple schedules may run in parallel and attempt bulk updates, which can result in a timeout. This issue can occur in any scenario where multiple schedules are likely to trigger simultaneously.
Update only the current record instead of bulk update. 
Using APIs of other services
Avoid implementing complex logic using multiple API calls when specific keys are available to handle the required calculations using a single call or fewer APIs.For Zoho Books, for example, instead of calling multiple APIs and looping through records to calculate the total number of invoices and their overall value, use the response_option key to perform the calculation directly. This avoids heavyweight scripting and reduces the number of API calls.

Script optimization examples

Example 1

❌ Fetching records, then iterating through each record like in the following script is not the most efficient method:
  1. fetchInvoices = Invoice_form[<criteria>];
  2. if(fetchInvoices.count() > 0)
  3. {
  4. for each invoice in fetchInvoices
  5. {
  6. <action>
  7. }
  8. }
✅ It is efficient to iterate over the records directly as part of the fetch operation:
  1. for each invoice in Invoice_form[<criteria>];
  2. {
  3. <action>
  4. }

Example 2

❌ Iterating over records to retrieve values like in the following script: 
  1. paymentList=List(); //creating a list variable
  2. for each invoice in PaymentAgainstInvoice[<criteria>] // iterating over fetched records
  3. {
  4. paymentList.add(invoice.ID); //extracting the ID and adding it to the list variable for each iteration
  5. }
✅ We can use built-in functions to perform the same operation efficiently:
  1. paymentList = PaymentAgainstInvoice[<criteria>].ID.getAll(); // all three above actions covered using a single statement

Example 3

❌ Similarly, instead of iterating over records to fetch the count of records like in the below script:
  1. recordcount = 0
  2. fetchInvoices = Invoice_form[<criteria>];
  3. for each lineitemcount in fetchInvoices
  4. {
  5. recordcount = recordcount + 1;
  6. }
✅ Use aggregate functions instead:
  1. recordcount = Invoice_form[<criteria>].count(ID);

Example 4

❌ Inserting records first, then modifying values of the insert record after a criteria check.
  1. billID = insert into Bill
  2. [
  3. Added_User=zoho.loginuser
  4. Total_Price=Total_Price
  5. Bill_Status=Bill_Status
  6. ];
  7. fetchBill = Bill[ID == billID];
  8. if(patient_Type == "Free")
  9. {
  10. fetchBill.Total_Price=0;
  11. fetchBill.Bill_Status="Closed";
  12. }

✅ Instead, we can perform the check before inserting the data:
  1. if(patient_Type == "Free")
  2. {
  3. Total_Price=0;
  4. Bill_Status="Closed";
  5. }
  6. billID = insert into Bill
  7. [
  8. Added_User=zoho.loginuser
  9. Total_Price=Total_Price
  10. Bill_Status=Bill_Status
  11. ];


Example 5

❌ Using APIs to update records and trigger post update logic.
  1. rec = Form[ID = <record_ID>];
  2. rec.Single_line = <value>;
  3. updateapi = zoho.creator.updateRecord(<owner_name>, <app_link_name>, <report_link_name>, rec.ID, <new_input_values>, <other_api_params>, <connection_link_name>);

✅ Instead, we can use the update record deluge task and trigger the post-update logic using a function:
  1. rec = Form[ID = <record_ID>];
  2. rec.Single_line = <value>;
  3. rec.Number = <value>;
  4. functionscript = thisapp.<function_with_on_success_code>(int rec.ID);

General Tips for Performance

  1. Avoid heavy nesting of scripts.
  2. Use an Else-If structure instead of multiple standalone If conditions, so the evaluation stops as soon as a matching condition is found.
  3. Use built-in functions wherever possible as they are optimized for performance.
  4. Try-Catch statements can be used to handle exceptions in the code.
  5. Tasks that do not need to run in real time can be moved to Schedules or handled using the async task instead.
  6. Use the Batch Workflows feature to efficiently, periodically, and automatically handle high-volume or repetitive operations on records. The records are processed based on the configured schedule, and you can break them down into smaller batches of up to 1000. This avoids looping through large sets of records at once, allows processing during non-business hours, and improves overall efficiency.
  7. Use the Environments feature to test changes, and push the updates to production during non-business hours to minimize impact on users.
  8. Plan thoroughly and model your application and workflows before implementation. Many performance issues stem from poorly designed application logic.
  9. It is not recommended to perform write operations from components like Pages, which are common interaction points for multiple users and may trigger multiple write actions at the same time, leading to performance issues. The same applies for auto-number fields, where high concurrency can cause delays or conflicts due to simultaneous generation of sequential numbers.
  10. Make use of system variables like zoho.appuri and zoho.appname instead of hardcoding such values, so that any changes to the application link name or the owner name are handled automatically. This is especially useful when using Deluge scripts inside HTML pages for embedding components.
  11. Make use of in-built features instead of scripting wherever possible. For example:
    1. Use Bidirectional Lookup through field properties instead of using scripts to reverse-assign values
    2. Set default values using the field properties instead of assigning them through scripts
    3. Use Formula fields to perform calculations wherever possible instead of scripting
  12. Using indexed fields in criteria help with fetching relevant records faster. Indexing is a back-end process, please contact us at support@zohocreator.com for assistance in enabling it.

Locks, Deadlocks, and Timeouts

Zoho Creator employs mechanisms to avoid conflicting scenarios, such as:
  1. Locking: A crucial and standard procedure for maintaining data integrity and consistency, especially in environments with high concurrent access. For example, when a record is being edited by one user, another user should not be able to modify that record at the same time, since this may lead to data corruption. Similarly, queries on a form-level are locked when a field is being added, deleted, or modified (such as marking a field as mandatory) in that form. During this period, any queries made on the concerned form may take longer to execute or even fail due to a timeout, until the form is released after the changes are complete.

  2. Deadlocks: Occur when two or more requests wait for each other to release locks, creating a cycle of dependencies leading to one of the requests to fail. For example, consider two workflows that update two records each, let's call them record A and record B. If Workflow 1 updates record A first, then B, while Workflow 2 updates record B first, then A, a deadlock can occur if both workflows are triggered simultaneously. In this case, Workflow 1 updates A and waits for B, which is locked because Workflow 2 is in the process of updating B. Meanwhile, after updating B Workflow 2 waits for A, which is locked by Workflow 1 since it cannot release record A until it updates record B as well, causing one of the Workflows to fail. The solution here is to follow a consistent update order of records, that is, both the workflows can be configured to updated record A first, then record B.

  3. Timeout: Happens when a request waits for too long, either due to connectivity issues, or because it is waiting for a lock to be released, waiting for a response, or when a transaction runs for more than the defined time limit. 

    Details of timeouts in Zoho Creator:
    Timeout
    Time Limit
    Description
    Record Lock timeout
    30 seconds
    The maximum time for which a request can wait for a record-lock to be released. If this limit is exceeded, the request fails.
    Transaction timeout for Batch workflows
    1 minutes
    The maximum time for which a Batch workflow can run. If this limit is exceeded, the entire transaction is rolled back.
    Transaction timeout for regular workflows
    5 minutes
    The maximum time allowed for all other workflow types to run. If this limit is exceeded, the entire transaction is rolled back.
    External API calls read timeout
    40 seconds
    The maximum time an API call can take to return a response before timing out.

Best Practices

  1. Try keeping the time taken for a request short, to minimize the time for which locks are held.
  2. Use Environments to test workflows, observe execution time, and rule out potential issues. Also check the number of records being affected by each workflow, keeping this number low helps reduce the processing time.
  3. Split large code blocks into smaller, independent chunks.
  4. Consistent Lock Ordering: Ensure workflows edit form records in a consistent order to avoid circular waits.
  5. Avoid too many API calls within the same workflow, as it can lead to locks being held for a longer duration.

Tracking App Performance

App Performance
Typically, all application screens are optimized to load under two seconds. A significant delay in this could signify a performance issue. However, it also depends on the complexity of the app, the number of tasks being performed in the backend, how optimized the code is, and so on. Without efficient application logic, it is impossible for the application to perform optimally. Additionally, Application Logs can be checked to determine any action failures that may be contributing to degraded performance.

Platform Availability
The Status page provides the current status of the platform availability in real time. This page can be used to check the service availability, current response times, and to track performance metrics of the platform. A spike in repsonse time may indicate a performance issue. This can be used to determine if performance is down on the service end or is specific to your service, in which case further debugging or code optimization may be required in your application logic.

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        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







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit

                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsFormstack alternativeEncrypted Forms

                              Wufoo alternativeSecure Forms

                              TypeformWCAG

                                All-in-one knowledge management and training platform for your employees and customers.

                                            Create. Review. Publish.

                                            Write, edit, collaborate on, and publish documents to different content management platforms.

                                            Get Started Now




                                                              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


                                                                    • Desk Community Learning Series


                                                                    • Digest


                                                                    • Functions


                                                                    • Meetups


                                                                    • Kbase


                                                                    • Resources


                                                                    • Glossary


                                                                    • Desk Marketplace


                                                                    • MVP Corner


                                                                    • Word of the Day


                                                                    • Ask the Experts


                                                                      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 Demo

                                                                                                        Get a personalized demo or POC

                                                                                                        REGISTER NOW


                                                                                                          Design. Discuss. Deliver.

                                                                                                          Create visually engaging stories with Zoho Show.

                                                                                                          Get Started Now








                                                                                                                              • Related Articles

                                                                                                                              • Manage Application Summary

                                                                                                                                The application summary page is a cumulative view of the application in Zoho Creator. This page serves as a common navigation point to branch out into various modules and perform actions relevant to those modules from here, and view the details ...
                                                                                                                              • Understanding application IDE

                                                                                                                                1. In a nutshell The Application IDE (Integrated Development Environment) is an editor that provides a comprehensive view of an application's components in script format(Deluge Script), such as forms, reports, pages, and workflows. It allows users to ...
                                                                                                                              • Setting Up and Managing Your Zoho Creator Account

                                                                                                                                What does this page cover Learn how to register for Zoho Creator, sign in if you already have an account, and verify your email address. This guide will walk you through the process step-by-step to ensure a smooth setup and verification. 1. Register ...
                                                                                                                              • Understanding application backup

                                                                                                                                In a nutshell Application Backup helps save copies of an app’s data, configuration, and code to prevent loss during system failures or updates. It ensures automated and cloud-based backups for rapid recovery and business continuity, essential for ...
                                                                                                                              • How to enable passkey based authentication for Zoho Creator portals

                                                                                                                                Note: Support for passkeys in Zoho Creator’s default portal login is currently under development and will be available soon. Until then, you can enable passkey based authentication for your portals by integrating any SSO provider that supports ...
                                                                                                                                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