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

    • Apply Vendor Credit Automatically

      Hello!!! Is there a way where in we can apply vendor credits automatically on the FIRST OUTSTANDING BILL of the vendor?? We have lots of VENDOR CREDITS ISSUES mostly!!! Applying it manually is a pain for us. Would be great if we have a way to apply the
    • Zoho Notebook Sync problem

      I'm facing a problem with syncing of notebook on android app. It's not syncing. Sometimes it syncs after a day or two.  I created some notes on web notebook but it's not syncing on mobile app. Please help!!!!
    • Cliq iOS can't see shared screen

      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
    • Retainer Invoice.

      Why ZOHO not have facilities to deduct partially advance payment from an invoice.
    • Apply Vendor Credits Automatically

      We are bulk importing Vendor credits in Zoho Books!!! Is there a way to apply vendor credits automatically to the first UNPAID bill of the Vendor?
    • Cant Save Gauge on Creator Page

      How to Save Gauge on Creator Page see movie https://vimeo.com/1116410860?share=copy#t=0
    • Apply Advance option not shown in report

      We are facing an issue in Zoho Expenses. While approving an Expense Report, the "Apply Advance" option is not appearing under the three dots (More Options). Details: Module: Expense Reports Issue: "Apply Advance" option not visible Status of Report: Awaiting
    • Introducing Assemblies and Kits in Zoho Inventory

      Hello customers, We’re excited to share a major revamp to Zoho Inventory that brings both clarity and flexibility to your inventory management experience! Presenting Assemblies and Kits We’re thrilled to introduce Assemblies and Kits, which replaces the
    • Auto Capitalize First Letter of Words

      Hi I am completely new to ZOHO and am trying to build a database. How can i make it when a address is entered into a form field like this: main st it automatically changes is to show: Main St Thank You
    • Follow-up emails via Workflow Automation not staying in the same thread

      Dear Zoho Support Team, I am currently using Workflow Automation in Zoho Campaigns to send follow-up emails. In my test case, I noticed the following behavior: All emails in the automation have the same subject line. If the follow-up email is sent within
    • Client Script refuses to set an initial value in Subform field

      I tried a very simple, 1 line client script to set a default value in a custom subform field when the "Add Row" button is clicked and the user is entering data. It does not work - can someone tell me why? ZDK documentation suggests this should be doable.
    • Formatting of Balance Sheet and Profit & Loss Reports

      The default format of the Balance Sheet and P&L Reports are based on the Account Types and then the individual accounts within the Chart of Accounts. These are then ordered alphabetically under these sub-headings and one is unable to re-order these or
    • Emails Are Not Being Delivered to My Inbox

      Hello Zoho Support Team, I am experiencing an issue with my Zoho Mail account. The most important problem is that emails are not being delivered to my inbox. Details: My Zoho Mail address: info@coreforcelife.com What happens: I am not receiving any incoming
    • Help Center IFrame Issue

      I have had a working Help Center on my website using an iframe for a while. But now for some reason the sign in page gets a refused to connect error. Can someone please help. If I go to the url manually it works correclty
    • Staff rules

      Hi! Do you people know what are the default staff rules when a new booking is created? We have two staff members in my team (me as the admin, and my employee). As we share the same services, I'm wondering how Zoho will pick the staff for new apointments.
    • Comment Templates

      Is it possible to add a template option for comments? We have some agents in the process who's responses require a pre-formatted layout. It would be incredibly handy to have a template for them where they can insert the template and then add their responses
    • [ZohoDesk] Improve Status View with a new editeble kanban view

      A kanban view with more information about the ticket and the contact who created the ticket would be valueble. I would like to edit the fields with the ones i like to see at one glance. Like in CRM where you can edit the canvas view, i would like to edit
    • Adding Markdown text using Zoho Desk API into the Knowledge Base

      Hi Zoho Community members, We currently maintain the documentation of out company in its website. This documentation is written in markdown text format and we would like to add it in Zoho Knowledge Base. Do you know if there is REST API functionality
    • An Exclusive Session for Zoho Desk Users: AI in Zoho Desk

      A Zoho Community Learning Initiative Hello everyone! This is an announcement for Zoho Desk users and anyone exploring Zoho Desk. With every nook and corner buzzing, "AI's here, AI's there," it's the right time for us to take a closer look at how the AI
    • Shared values: From classroom lessons to teaching moments in customer service

      While the world observes Teachers’ Day on October 5, in India, we celebrate a month earlier, on September 5, to mark the birth anniversary of Dr. Sarvepalli Radhakrishnan, a great teacher, renowned scholar, educationist, and advocate for empowerment.
    • Export to excel stored amounts as text instead of numbers or accounting

      Good Afternoon, We have a quarterly billing report that we generate from our Requests. It exports to excel. However if we need to add a formula (something as simple as a sum of the column), it doesn't read the dollar amounts because the export stores
    • Create a list of customers who participated in specific Zoho Backstage events and send them an email via Zoho CRM

      How to create a list of customers who participated in specific Zoho Backstage events and send them an email via Zoho CRM? I was able to do a view in CRM based on customer that registered to an event, but I don't seems to be able to include the filter
    • Zoho Desk blank page

      1. Click Access zoho desk on https://www.zoho.com/desk/ 2. It redirects to https://desk.zoho.com/agent?action=CreatePortal and the page is blank. Edge browser Version 131.0.2903.112 (Official build) (arm64) on MacOS
    • I hate the new user UI with the bar on the left

      How can I reverse this?
    • Constant color of a legend value

      It would be nice if we can set a constant color/pattern to a value when creating a chart. We would often use the same value in different graph options and I always have to copy the color that we've set to a certain value from a previous graph to make
    • Question regarding import of previous deals...

      Good afternoon, I'm working on importing some older deal records from an external sheet into the CRM; however, when I manually click "Add New Deal" and enter the pertinent information, the deal isn't appearing when I look at the "Deals" bar on the account's
    • Client Script also planned for Zoho Desk?

      Hello there, I modified something in Zoho CRM the other day and was amazed at the possibilities offered by the "Client Script" feature in conjunction with the ZDK. You can lock any fields on the screen, edit them, you can react to various events (field
    • One person/cell phone to manage multiple accounts

      Hi. I have a personal Free account to keep my own domain/emails. Now I need to create a Business account to my company's own domain, but I have only one mobile phone number I use to everything. How do I do to manage this? Can I manage a Free domain and
    • Tracking KPIs, Goals etc in People

      How are Zoho People users tracking employee targets in People? For example, my marketing assistant has a target of "Collect 10 new customer testimonials every month". I want to record attainment for this target on a monthly basis, then add it to their
    • Zoho Desk: Ticket Owner Agents vs Teams

      Hi Zoho, We would like to explore the possibility of hiding the ‘Agents’ section within the Ticket Owner dropdown, so that we can fully utilise the ‘Teams’ dropdown when assigning tickets. This request comes from the fact that only certain agents and
    • Can not Use Attachment Button on Android Widget

      this always pops up when I touch the attach button on android widget. going to settings, there is no storage permission to be enabled. if I open the app, and access the attach feature there, I can access my storage and upload normally.
    • Announcing new features in Trident for Mac (1.24.0)

      Hello everyone! Trident for macOS (v.1.24.0) is here with interesting features and thoughtful enhancements to redefine the way you plan and manage your calendar events. Here's a quick look at what's new. Create calendar events from emails. In addition
    • Need Easy Way to Update Item Prices in Bulk

      Hello Everyone, In Zoho Books, updating selling prices is taking too much time. Right now we have to either edit items one by one or do Excel export/import. It will be very useful if Zoho gives a simple option to: Select multiple items and update prices
    • Vendor Master Enhancements for Faster Purchase Entry

      I’d like to suggest a few features that will improve accuracy and speed during purchase voucher entry: Automated Item Tax Preference in Vendor Master Add an option to define item tax preference in the vendor master. Once set, this preference should automatically
    • Mass Mail Statistics - Number of unsent emails

      How do I find out which emails were not sent?
    • Est-il possible d'annuler l'envoi d'un mail automatique ?

      Bonjour, Lorsque je refuse un candidat, il reçois un mail dans les 24h pour l'informer que sa candidature n'est pas retenue. J'ai rejeté un candidat par erreur. Savez-vous s'il possible d'annuler l'envoi de ce mail ? Merci d'avance pour votre aide.
    • Can't change form's original name in URL

      Hi all, I have been duplicating + editing forms for jobs regarding the same department to maintain formatting + styling. The issue I've not run into is because I've duplicated it from an existing form, the URL doesn't seem to want to update with the new
    • embed a form in an email

      Hello, how to embed a form in an email that populates Zoho CRM cases? I would like to send emails to a selected audience offering something. In the same email the recipients - if interested - instead of replying to can fill in a Zoho CRM form that creates
    • Zoho Bookings - Reserve with Google

      Does Zoho Bookings plan to to integrate with Reserve with Google?
    • How to add Zoho demo site page designs to my Zoho Sites website

      Hi, I would like to add the design from the following demo URLs into my current Zoho website. I have already created two new pages on my site, named “Menu2” and “Menu3.” For the “Menu2” page, I want to use the design from this demo: https://naturestjuice-demo.zohosites.com/menu
    • Next Page