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

    • CRM limit reached: only 2 subforms can be created

      we recently stumbled upon a limit of 2 subforms per module. while we found a workaround on this occasion, only 2 subforms can be quite limiting in an enterprise setting. @Ishwarya SG I've read about imminent increase of other components (e.
    • LESS_THAN_MIN_OCCURANCE - code 2945

      Hi I'm trying to post a customer record to creator API and getting this error message. So cryptic. Can someone please help? Thanks Varun
    • How to update "Lead Status" to more than 100 records

      Hello Zoho CRM, How do I update "Lead Status" to more than 100 records at once? To give you a background, these leads were uploaded or Imported at once but the lead status record was incorrectly chosen. So since there was a way to quickly add records in the system no matter how many they are, we are also wondering if there is a quicker way to update these records to the correct "Lead Status". I hope our concern makes sense and that there will be a fix for it. All the best, Jonathan
    • Analytics for notes created

      Is there a way I can see how many notes were created per day? Via reporting or analytics?
    • Add Custom Reports To Dashboard or Home Tab

      Hi there, I think it would be great to be able to add our custom reports to the Home Tab or Dashboards. Thanks! Chad
    • Cannot update Recurring_Activity on Tasks – RRULE not accepted

      Hello, I am trying to update Tasks in Zoho CRM to make them recurring yearly, but I cannot find the correct recurrence pattern or way to update the Recurring_Activity field via API or Deluge. I have tried: Sending a string like "RRULE:FREQ=YEARLY;INTERVAL=1"
    • Add image to report...

      Greetings, I send a weekly color coded report via Creator email. I would like to add the legend somewhere in the report. Header, footer where ever. I have the legend saved on Google Drive and can access it via shared link. Sure someone has wanted to add
    • More controls for User Fields in CRM

      Dear All, We are here with a minor but crucial enhancement to the user fields—now set accessibility permissions to the records for user field. User field allows you to extend co-ownership of records to your peers. You can collaborate with them for certain
    • Calls to accounts rather than leads or contacts?

      So..... We have a dilemma and I'm hoping someone has encountered this before and figured out a fix. We have just migrated to Zoho. It's great.....expect for how "Calls" are handled.... We are B2B. We do not use the leads module. A "Lead/Prospect" for
    • Image Upload Field | Zoho Canvas

      I'm working on making a custom view for one of our team's modules. It's an image upload field (Placement Photo) that would allow our sales reps to upload a picture of the house their working on. However, I don't see that field as a opinion when building
    • Power of Automation :: Automated 'Delayed & Closed' Status Update Based on Due Date

      Hello Everyone, 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
    • Lead Blueprint transition in custom list view

      Hi, Is It possible to insert the Blueprint transition label in a custom Canvas list view? I am using Lead module. I see the status, but it would be great if our users could execute the Blueprint right from the list view without having to enter the detailed
    • Range names in Zoho Sheet are BROKEN!

      Hi - you've pushed an update that has broken range names. A previously working spreadsheet now returns errors because the range names are not updating the values correctly. I've shared a video with the support desk to illustrate the problem. This spreadsheet
    • Has anyone integrated SMS well for Zoho Desk?

      Our company does property management and needs to be able to handle inbound sms messages which create a ticket for Zoho Desk. We then need to be able to reply back from Zoho desk which sends the user an sms message. This seems like a fairly common thing
    • populate email address and name in zoho desk?

      Is it possible to populate the email address and name in the zoho desk widget? We only use it in the context of an authenticated user, so we already know the user's name and email. Thanks,
    • Are there default/pre-built dashboards in Zoho Desk?

      Hi, I am looking for some pre-built dashboard templates in Zoho Desk, similar to what we can find in CRM/Projects, etc Thank you
    • Enable Locations for Expense

      Hi, please enable Locations (ex Branches) for Zoho Expense so that there is consistency between this app and Zoho Books. Thanks in advance.
    • Adding branded signature to tickets reply

      Hi, i am unable to figure out how to add signatures with logo to tickets reply. please advice .
    • Zoho Marketing Automation 2.0 - Landing Page function not working

      Dear Zoho Team, I am working on implementing Zoho Marketing Automation 2.0, and am now looking into the section "Lead Generation". If I open the "Landing Pages" section, I immediately get an Error code: Error: internal error occurred. Can you help me
    • Zoho Mail Android app update: Manage folders

      Hello everyone! In the latest version(v2.9) of the Zoho Mail Android app update, we have brought in support for an option to manage folders. You can now create, edit, and delete folders from within the mobile app. You can also manage folders for the POP
    • How to share ticket numbers across different ticket types

      I'm running an event and have three different ticket types. Add on Event + Main Event - Early bird Main Event only - Early bird Add on Event only - Early bird And Standard class - shown but not available until early bird finishes Add on Event + Main Event
    • How to keep track of bags, cans, drums of inventory?

      We buy and sell products that are packaged in bags 🛍️, cans🥫, drums🛢️, etc. with batch numbers. When we get a shipment of one of the products, how do we track we received (say) 10 cans each of 5L of a product and maybe we received 10 cans of another
    • Adding Social Media Buttons to Basic Campaigns

      Hi, I'm quote new to using Zoho Campaigns and I can't work out how to add Social Media Buttons into my basic campaign? In MailChimp there's a button that brings the icons into your campaign for you. I've tried adding the social media icons as 'buttons' in Zoho but it's not looking great. Can anyone help? Thanks!
    • Hide Inactive Social Sign-In Providers from Login Screen

      Hello Zoho Team, We hope you are doing well. Currently, Zoho One allows admins to configure security policies and enable or disable Social Sign-In options for third-party providers such as Apple, Google, Microsoft, LinkedIn, Yahoo, Twitter, Facebook,
    • [Free Webinar] AI Agents in Zoho Creator - Creator Tech Connect

      Hello Everyone! We welcome you all to the upcoming free webinar on the Creator Tech Connect Series. The Creator Tech Connect series is a free monthly webinar that runs for around 45 minutes. It comprises technical sessions in which we delve deep into
    • Download All Attached Files

      It would be extremely useful to have "download-all" functionality for downloading files attached to a task, subtask, comment, forum post or hosted in the "Documents" section etc. We've instructed our users to zip multiple files prior to uploading, but of course they forget all the time. Having to download lots of files one-at-a-time off a comment or task wastes a lot of time.
    • Ship via Carrier Not Working Since Commerce Update

      Since the recent update to the Commerce platform, I can no longer use the ship via carrier function. It will take me to the address screen and let me verify them but when I go to save and move tot he next screen it will not do anything. This is happening
    • automations: Can I execute a step on a specific date?

      I have created a form in Zoho forms, and created a contacts list. I have also begun setting up an automation with the intention of sending the form to the contact list on a specific date every month (via email) for the entire year (essentially sending
    • Zoho Expense - The ability to add detail to a Trip during booking

      As an admin, I would like the ability to add more detail to the approved Trips. At present a requestor can add flights, accommodation details and suggest their preferences. It would be great if the exact details of the trip could be added either by the
    • Adding Folders in Android App

      Is it possible to create a new email folder within the Zoho Mail Android app?  Or can this only be done from the desktop version of Zoho Mail? Cheers!
    • Schedule Exports for Regular Project Updates

      Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
    • Question about custom fields using Pivot Tables.

      I have created a pivot table showing annual revenue of a client and how much payment that client is paying my company. Is there a way using pivot table to add an additional field that subtracts those to fields / shows me a percentage of that difference?
    • Request for Light/Dark Mode

      Would love the ability to switch between Light and Dark mode similar to Zoho CRM. https://help.zoho.com/portal/en/community/topic/introducing-dark-mode-light-mode-a-new-look-for-your-crm
    • Signature field is showing black

      Hello, When customer signed the service form, it is showing as below picture Phone model: iPhone 16 Pro We tried delete and install application, but it not solved. This has on phone of a few person. There is any advice to solve this?
    • Journey Email - Ignored Contacts

      I have a journey setup which simply sends a string of emails over time. For some reason I am getting large amounts of the contacts who enter the first email being ignored and I can't find anywhere in reports or audit logs why these contacts are not
    • Involved account types are not applicable when create journals

      { "journal_date": "2016-01-31", "reference_number": "20160131", "notes": "SimplePay Payroll", "line_items": [{ "account_id": "538624000000035003", "description": "Net Pay", "amount": 26690.09, "debit_or_credit": "credit" }, { "account_id": "538624000000000403", "description": "Gross", "amount": 32000, "debit_or_credit": "debit" }, { "account_id": "538624000000000427", "description": "CPP", "amount": 1295.64, "debit_or_credit": "debit" }, { "account_id": "538624000000000376", "description":
    • Zoho Books - Include Payment Terms as a Custom View filter

      It would be great if you could created a custom view based on Payment Terms. This would be really handy for seeing a list of customers who have credit terms. A workaround is not required. I could do something with a creditor checkbox, but it would be
    • How to update changed purchase account of item in invoice

      I have selected the wrong purchase account for various articles and created invoices. I had to adjust the purchase account in the article afterwards, but the old purchase account is still posted in the transaction-journal of the invoice. To adjust the
    • Help - Zoho CRM notification on mobile (IOS/Android)

      Hello Community! Can I get the IOS/Andoid CRM app to notify me of events, calls, etc. due as I can with MANY other apps?   I am running the free Zoho I would like this to be native to the Zoho CRM app. I do not want to write a sep. mobile app
    • Zoho Books Idea - Include another field in Bank Details for Address

      Hi Books team, Currently use the Description field in the Bank Details to store the bank's address. This works fine but it would be great if you could add another field for Bank Address, so that other notes about the bank account could be stored in the
    • Next Page