Kaizen 196 - Zoho CRM Queries - Best Practices

Kaizen 196 - Zoho CRM Queries - Best Practices

 Nearing 200th Kaizen Post – We want to hear from you!
Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone. 

Hello everyone!
Welcome back to another post in the Kaizen series!

Queries in Zoho CRM can power much of what makes a customized CRM experience work—Canvas views, Kiosk pages, custom related lists, and more.

But writing effective queries goes beyond just “getting the data.” It’s about writing queries that are reusable, performant, and easy to maintain.

This Kaizen highlights some of the field-tested best practices to make your queries smarter and your CRM UI smoother.

1. Choose the right query type

Your choice of query type defines your flexibility, and matching the query type to the task reduces unnecessary complexity.
  • Module-type queries work best when you need a quick fetch from a single module. For straightforward data retrieval, a simple Module query is often faster and easier to manage.
  • COQL-type queries follow the SQL-like language model and allow you to filter, sort, and join data more deeply.
  • REST API-type queries enable Zoho CRM to retrieve real-time data from external systems via GET requests, allowing you to display externally computed or stored information within CRM views.

2. Name your queries clearly and consistently

  • Avoid query names like Get_Contacts_Test or Canvas_Query_1 as they become confusing over time.
  • Instead, use names that reflect what the query actually returns and where it is used. For example, Open_Deals_By_Owner_For_Canvas, Upcoming_Activities_By_Account. This helps you or your team find and reuse queries faster.

3. Use nested lookups selectively

  • Use nested lookups in COQL-type queries selectively to balance power and performance. Nested lookups in COQL help in reducing the number of API calls by fetching related records in the same query, but use only the lookup fields that are truly necessary when using queries in UI components or optimizing for speed.
  • Limit yourself to the lookup fields your UI or logic actually needs. For example, do not retrieve Account.Owner.Territory.Name if you're only displaying the account name.
  • If multiple nested fields are needed for display, consider flattening the data using serializers to keep the query clean and efficient.

4. Limit returned record count for list views

  • For queries used in related lists or Canvas, fetch only the required number of records/rows to keep your UI focused and efficient.
  • For example, in a Canvas View, it is best to fetch only the immediately relevant records like the latest notes, top deals, most recent activities etc,. This ensures that the data is concise, relevant, loads the UI quickly, and remains user-friendly across devices.

5. Use Variables to keep queries reusable

  • Hard-coding values like record IDs or user names limits reusability.
  • Instead, define variables like {{User_ID}}, {{Record_ID}}, or {{Account_ID}}, and pass them dynamically. This means you can use the same query across multiple records, users, or components.

6. Blend static and dynamic filters

  • Not all values need to be variables.
  • If a certain condition will always be true like 'Status = Open', hard-code it. But for user-specific and record-specific values, create variables. This mix of static and dynamic variables in your filters makes your query both specific and versatile.

7. Avoid fetching unnecessary fields

  • Avoid selecting all fields by default. Fetching unnecessary fields increases response size and adds clutter.
  • Limiting the field selection makes the query easier to maintain, especially when working with nested lookups and across modules.
  • Smaller and focused responses are easier to format and bind in the UI components leading to better data handling.
  • Even though CRM handles larger data well, brevity in the query leads to faster rendering and, ultimately, a better user experience.

8. Use serializer to format your output

  • Don’t pass raw API data directly into your UI. Use serializers to clean, rename, and shape your response.
  • For example, merge first and last names into a single full name field in the serializer.
  • This keeps the UI logic clean and puts formatting responsibility where it belongs—inside the query layer.

9. Customize the schema after your query

  • Zoho CRM auto-generates a schema for your query output, but it may not reflect exactly how they're used in your interface.
  • Rename keys to reflect how they’re used in your interface, remove unused fields, and flatten nested objects where possible.
  • A clean and relevant schema makes data binding faster and reduces errors.

10. Understand your return type: Map vs Table

  • Use a Map when returning a single record (like in a summary view).
  • Use a Table when returning a list (like in a data grid or related list).
  • Using the wrong type and misalignment can break your Canvas component, show blank widgets or broken layouts.

11. Map queries to the right components

Design your queries with the target component in mind. This ensures clarity, reusability, and context-driven results.
  • In Canvas, use queries to control what each widget displays.
  • In Kiosk, tie queries to user flows or form submissions.
  • In Custom Related Lists, pass record-level variables like {{Deals.Deal_ID}} for contextual filtering.

12. Use record ID-based filters properly

  • Filtering with ID variables is common and useful, but too many queries filtered by IDs can lead to firing many API calls and consuming more API credits.
  • Reuse queries and batch where possible.

13. Standardize REST API outputs with the 'crmAPIResponse' object

  • REST API type queries give you flexibility, but may not return the response in the format that your UI expects.
  • Use the 'crmAPIResponse' object to standardize the output, extract what you need, and define fallback values in case something is missing.
  • This control in the output structure allows you to fit the output to your schema and maintain consistency across your queries.

14. Use Queries to supercharge related lists

  • Queries can now power custom Related Lists where you are not limited to predefined module relationships.
  • Use parent record variables to filter child records, apply sorting logic, and format fields for a clean display.
  • Keep the row count reasonable for performance and readability.

15. Always test and monitor

Before going live
  • Try the query to preview data, validate filters, and confirm variable substitution. It’s far easier to fix errors here than once the query is embedded in a Canvas view or live layout. Include user role and profile tests where needed.
  • Check how schema or field updates affect the output.
  • Log serializer issues or failed REST calls during development.

Good queries don’t just fetch data—they shape the user experience. Whether you’re building a dashboard or a simple record view, thoughtful query design ensures you deliver the right information, fast, and in the format that makes sense to your users.

We hope you liked today's post. We will see you next week with another one!
Cheers!






    • Sticky Posts

    • Kaizen #197: Frequently Asked Questions on GraphQL APIs

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Kaizen #198: Using Client Script for Custom Validation in Blueprint

      Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Celebrating 200 posts of Kaizen! Share your ideas for the milestone post

      Hello Developers, We launched the Kaizen series in 2019 to share helpful content to support your Zoho CRM development journey. Staying true to its spirit—Kaizen Series: Continuous Improvement for Developer Experience—we've shared everything from FAQs
    • Kaizen #193: Creating different fields in Zoho CRM through API

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Client Script | Update - Introducing Commands in Client Script!

      Have you ever wished you could trigger Client Script from contexts other than just the supported pages and events? Have you ever wanted to leverage the advantage of Client Script at your finger tip? Discover the power of Client Script - Commands! Commands
    • Recent Topics

    • Zoho Books Idea - Bank Details Button on Banking

      Hi Books team, Sometimes I'm asked to share bank details with a customer or a colleague. So I go to the Banking Module, find the correct bank account, click Setting > Edit, then copy and paste the bank details. Wouldn't it be great if there was a button
    • JS SDK 8.0 – TypeError: Cannot read properties of undefined (reading 'getCacheStore') with sample code

      Hello Zoho Support Team, I’m integrating the Zoho CRM JavaScript SDK v8.0 and I’m getting the error below when running your official sample. I tested directly from: https://github.com/zoho/zohocrm-javascript-sdk-8.0/blob/main/samples/create_records_sample/create_records.js
    • Function #55: Convert multiple quotes to single SO using Custom Button

      Hello everyone, and welcome back to our series! In Zoho Books, after a quote is accepted by your customer, it can be converted into a sales order or an invoice. Often, a customer might have multiple quotes, and for easier billing or upon the customer's
    • Zoho One - Syncing Merchants and Vendors Between Zoho Expense and Zoho Books

      Hi, I'm exploring the features of Zoho One under the trial subscription and have encountered an issue with syncing Merchant information between Zoho Expense and Zoho Books. While utilizing Zoho Expense to capture receipts, I noticed that when I submit
    • Rich Text For Notes in Zoho CRM

      Hello everyone, As you know, notes are essential for recording information and ensuring smooth communication across your records. With our latest update, you can now use Rich Text formatting to organize and structure your notes more efficiently. By using
    • Time based workflow without edit/action

      Hello I need help solving this problem if possible. We have Deals come into the CRM via Live Transfer which have the field properties: Stage = New Channel = Inbound Some of them don't get answered so we want these to automatically go into our Outbound
    • What's New - August 2025 | Zoho Backstage

      Every month, Zoho Backstage grows with you. These updates aren't just features and fixes, they're about making your workday smoother, your events more impactful, and your attendees happier. We’ve listened, learned, and shaped this release to keep things
    • prevent selling expired items

      Hello. I need to make a constraint on expired batch items not to be sold. Is it possible in Zoho Inventory? if so, then how? Thanks for further help.
    • Product details removed during update from other system

      We maintain our product details in an other system. These details are synchronized with Zoho at the end of each day, through an API. This has worked perfectly sofar. But last Monday, all product codes and some other product data have been wiped during
    • Client Customer

      I purchased a customer user license, but we cannot see the project I added in the customer account. I would like to ask for support on what we should do.
    • Add Ability to Use Zoho Finance Tags

      For Zoho Finance (Books and Inventory), the current actions do not allow us to affect the tags associated with the entities in question (customers, vendors, items, etc.). Please consider adding this functionality into the actions.
    • Embeded Signing doesn't work on Safari Browser

      We have implemented Zoho Sign in our website by using embeded signing, It works perfectly on Chrome. But it fails on Safari, We get stuck on Zoho Sign Page during redirection from Zoho Sign to our website after signing the document, Please let us know
    • Dataprep Webhook Limits and Cannot update column with Dataprep

      I have two problems : 1 - I am using Airflow to trigger my pipeline, and when I tested it, it worked fine a couple of times. However, after that, I received an error: {"code":429,"message":"Request rate limited"}. I didn’t send too many requests — maybe
    • Power of Automation :: Automatic removal of project users once the project status is changed.

      A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate complex tasks and
    • New in Zoho Forms: Google reCAPTCHA v3 for smarter spam protection

      Hello form builders, Spam submissions are one of the biggest challenges when you share your forms online. They not only clutter your data but can also waste valuable time. To help you combat this without making life harder for genuine respondents, we’re
    • Project Management Bulletin: August, 2025

      We’ve touched a grand 19 years since we started pioneering project management solutions with Zoho Projects. What started as a simple one-page interface is now a suite of products with Zoho BugTracker, Zoho Sprints, and our new debut Zoho Projects Plus,
    • Zoho Sign and Zoho Workdrive Integration

      Hello, there. I want to know if it's possible to save a signed document from Zoho Sign in an specific folder for each signer in Zoho Workdrive.  For example: If John Doe signs the document in Zoho Sign I want to save it automatically in a folder named
    • Office 365 and CRM mail integration: permission required

      Has anyone run into this weird problem? My email server is Office 365. When I try to configure Zoho CRM to use this server, a Microsoft popup window opens requesting user and password. After entering that, I get a message in the Microsoft window saying
    • Empowered Custom Views: Cross-Module Criteria Now Supported in Zoho CRM

      Hello everyone, We’re excited to introduce cross-module criteria support in custom views! Custom views provide personalized perspectives on your data and that you can save for future use. You can share these views with all users or specific individuals
    • How do you list multiple contacts for a lead?

      My sales team wants to be able to add additional contacts for leads, how do we do that? Is there a different way we should be using the lead / contact functionality? Moderation update (9th September 2025): Our developers have built an extension to achieve
    • Modifying Three Dot Menu Options

      Is there a way to modify the three dot menu options that display in a Report header? They currently display: Show As (List, Calendar, Timeline), Print, Import, Export. I'd like to remove the Show As and Print options, since they aren't applicable for
    • Field Not Updating in FSM Script - Service and Parts module.

      Dear Team, I am reaching out regarding a script I have implemented in Zoho FSM to automate the calculation of the End of Service date based on the End of Sale date in the Service and Parts module. Overview of the script: Fetches the End_of_Sale__C and
    • Zadarma + Zoho CRM Integration – Missed Calls Saved as Contacts Instead of Leads

      Hello everyone, I’m looking for input from anyone with experience using the Zadarma + Zoho CRM integration. Currently, I’m seeing that missed calls are automatically being created as Contacts instead of Leads. From a CRM perspective, this doesn’t make
    • Zoho Books | Product updates | September 2025

      Hello users, We’ve rolled out new features and enhancements in Zoho Books. From PayNow payment method to applying journal credits to invoices and bills in other locations, explore the updates designed to enhance your bookkeeping experience. Integrate
    • How to update Multiple Users field in Quote Module from Deal Module

      Scenario : Deal Module having Multiple User Field (Presales Engineer) which having more than 1 User and through Deluge Script I need to get that Users Details and need to put into Multiple User Field (Presales Engineer) of Quote Module. Note: Both Module
    • Auto-sync field of lookup value

      This feature has been requested many times in the discussion Field of Lookup Announcement and this post aims to track it separately. At the moment the value of a 'field of lookup' is a snapshot but once the parent lookup field is updated the values diverge.
    • Clone a Module??

      I am giong to repurpose the Vendors module but would like to have a separate but very similar module for another group of contacts called Buyers. I have already repurposed Contacts to Sellers. Is it possible to clone (make a duplicate) module of Vendors
    • Advance PDF creation from CRM data

      I'm trying to create a PDF export of data in the CRM. My problem is I want a pretty complicated format for the data. I'm trying to export multiple modules worth of data, with nested one-to-many relationships between the modules. Along with that, I want
    • how to disable staff selection Zoho Booking integrated to SalesIQ?

      currently there is only one Consultant in my Zoho Bookings like this I integrate Zoho Bookings into Zoho SalesIQ to create a chatbot. Unfortunately, even though I only have one consultant for a consultation, the user have to pick the consultant. It will
    • How to change the text in WhatsApp Zobot integrated to Zoho Booking?

      I have integrated Zoho Bookings into Zoho SalesIQ, I want to change the text in WhatsApp when creating a booking in Zobot how to change those text?
    • Updating Subform Record from other Form

      Just wanted to ask how to properly approach this. I have 2 forms and would like to trigger an auto update on the subform once record submitted. block below only updates 1 row for each recordRow in input.AV_System { AssetRecord = Site_Asset_Services[SOR_No
    • when I email a invoice how can i see it was sent and also were i can go to see all emails sent

      when I email a invoice how can i see it was sent and also were i can go to see all emails sent?
    • Zoho Books - Hide Convert to Sales Order if it can't be used.

      Hi Books team, I noticed that it is not possible to convert a Quote to a Sales Order when a Quote is not yet marked as accepted. My idea is to not show the Convert to Sales Order button when it is not possible to use it, or show it in a grey inactive
    • How do I bulk archive my projects in ZOHO projects

      Hi, I want to archive 50 Projects in one go. Can you please help me out , How can I do this? Thanks kapil
    • Cross-Data Center Collaboration and / Or allowing users to choose DC

      Dear Zoho Cliq Support Team, We are writing to request a significant enhancement to Zoho Cliq that would greatly benefit our geographically dispersed development team. Current Challenge: Currently, Zoho Cliq automatically routes users to specific data
    • Zoho Flow - Update record in Trackvia

      Hello, I have a Flow that executes correctly but I only want it to execute once when a particular field on a record is updated in TrackVia. I have the trigger filters setup correctly and I want to add an "update record" action at the end of the flow to
    • New Mandatory One-Click Unsubscribe Link Overshadowing Custom Unsubscribe Link

      I was recently informed by Zoho CRM Support that they are now mandated by the large email service providers like Google and Yahoo to provide a one-click unsubscribe option in the header (not the body) of all mass emails. I have a custom unsubscribe link
    • Send / Send & Close keyboard shortcuts

      Hello! My team is so close to using Zoho Desk with just the keyboard. Keyboard shortcuts really help us to be more efficient -- saving a second or two over thousands of tickets adds up quickly. It seems like the keyboard shortcuts in Desk are only for
    • Is it possible to register webhooks in Zoho CRM using API?

      Hello, I am trying to register a webhook in Zoho CRM programmatically (using the API). Specifically, I want to register a webhook that is fired when new Contacts are created in the CRM. I was able to setup a webhook using the UI, by creating a rule that
    • Calls where the local audio is shared, have echo

      When another user is sharing their screen with audio, I get echo from my own voice. We tested this with multiple users, with different audio setups, and there's no obvious way to fix it. Is this a bug you could look into, or are we missing something?
    • Next Page