Kaizen #176 - Optimizing the Use of Record ID Variables in Zoho CRM Queries

Kaizen #176 - Optimizing the Use of Record ID Variables in Zoho CRM Queries


Hello everyone!

Welcome to another week of Kaizen!


Today, we are back with another one on Queries.
In this post, we will discuss how you can optimize record ID as a variable in Queries.

What are variables in Queries?

Variables are placeholders in queries that take values at runtime. Variables make queries flexible and reusable, avoiding the need to hard-code data.

When you create a query, you can leverage record ID variables in two ways:
  1. Filter By field
  2. Criteria
Each method has its own benefits and considerations. Let's explore them in this post.

1. Using record ID variable in the "Filter By" field

When you use the record ID variable in the "Filter By" field of a query, you streamline the data retrieval process by directly targeting the specific records you need. This method is particularly useful when you want to narrow down your search to specific record based on their IDs. Simply put, this behaves as the Get Record by ID.

Consider an example, where Interested_Product is a lookup in Contacts. Our aim is to get the details of the product that the contact is interested in. We can create a query of type CRM - Module as shown in the following image.

  1. The base module is Contacts, and the related module is Products that is linked via the lookup field.
  2. Choose the required fields you want to retrieve through the query.
  3. In Filter by, select Record ID.
  4. Give the variable to hold the contact's ID in the Record ID field. The format is {{variable_name}}.
  5. The query assigns the ID of the contact dynamically during runtime.
  6. Click Next.
  7. A pop-up asks for the value of the variable.

  8. Input the ID of the contact and click Save.
  9. The response contains the fields that were queried for.

Benefits of having the record ID variable in "Filter by"

  • Efficiency: Directly retrieves the relevant records, reducing the need to sift through unnecessary data.
  • Simplicity: Easy to set up and understand, making it ideal for direct queries.

Considerations

  • Limited Flexibility: May not be suitable for complex queries requiring multiple conditions or criteria.
  • Specific Use Cases: Best used for scenarios where you have a clear and specific record ID to filter by.

2. Using Record ID Variable in Criteria While Fetching Related Records

Using the record ID variable in criteria while fetching related records allows for more complex and dynamic queries. This approach is useful when you need to retrieve related data based on certain conditions or criteria.
Consider an example where you want to retrieve deals of a contact. A deal can have multiple contacts, but you want to fetch only those deals that are related to a particular contact. This case warrants the need for criteria to filter based on the ID of the contact.
Construct a query as follows:
  1. Create a CRM - Module type query for the Deals module.
  2. Choose Contacts as the Related Module.
  3. Select the fields from these two modules that you want to retrieve.

  4. Select "Criteria" and create a variable for the record ID of the contact.

  5. Click Save and click Next.
  6. Give a contact ID for the variable in the pop up.

  7. Click Save and click Next.
  8. You can see the response to the query.

Benefits of using record ID variable in "criteria"

  • Flexibility: Allows for more complex queries with multiple criteria.
  • Dynamic Data Retrieval: Useful for scenarios where the criteria for related records may change based on different conditions.
  • Comprehensive Data: Fetches a broader range of related records, providing a more holistic view of the data.

Considerations

  • Complexity: More suitable for complex queries and requires deeper understanding of how modules are related in Zoho CRM.

Conclusion

Both methods offer their opportunities and challenges in Zoho CRM's data management.
Choosing the right approach depends on your specific needs and the complexity of your queries. For efficient and simple data retrieval, using the record ID variable in the "Filter By" field is ideal.
For more complex and dynamic queries, leveraging the record ID variable in criteria while fetching related records offers greater flexibility.

Experiment with both approaches to see which one fits your use case best.

Share your experiences in the comments or write to us at support@zohocrm.com, and help others optimize their data retrieval strategies in Zoho CRM!

Stay tuned for more posts in this series!

Cheers!

----------------------------------------------------------------------------------------------------------------------------------

      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ






                                ご検討中の方

                                  • Recent Topics

                                  • スマホでキャンペンメールを見ると正しく表示されない

                                    キャンペーンのメール(HTML)を作成しましたが、スマホ表示に切り替えると正しく表示されません(添付参照)過去に作成したキャンペーンでは特に意識してませんでしたが、問題なく表示されていたようです。うまく表示される場合とされない場合の違いは何でしょうか?
                                  • Ability to Set Client Name During Portal Invitation

                                    Hi Zoho Team, We would like to suggest an important enhancement to the Zoho Creator Client Portal functionality. Zoho Creator recently introduced the option to set a client’s display name in the Client Portal settings, which is very helpful for creating
                                  • Zoho CRM - Calendar Cards View - Let Users Decide What Is Displayed On Calendar Entries

                                    Imagine planning your week of face-to-face meetings across three counties. You’re trying to group appointments by location to make the best use of your time, but Zoho CRM’s calendar doesn’t show where each meeting is happening. You’re left trying to remember
                                  • 136.143.188.51 blocked by spamcop

                                    Zoho mailserver seems to be blocked by spamcop. Cant send mail to my customer. Not sure what to do.
                                  • Good news! Calendar in Zoho CRM gets a face lift

                                    Dear Customers, We are delighted to unveil the revamped calendar UI in Zoho CRM. With a complete visual overhaul aligned with CRM for Everyone, the calendar now offers a more intuitive and flexible scheduling experience. What’s new? Distinguish activities
                                  • Dashboard Autorefesh

                                    Good day, I am a dashboard that displays the number of tickets based on "Product Name". This dashboard is displayed on a big TV for the team to monitor. Can the dashboard auto-refresh every few minutes to display the new values? Currently, we have closed
                                  • Would be really awesome to have Created Time and Modified Time showing for custom functions list

                                    It would be SO HELPFUL to be able to sort custom functions by created time/ modified time. Also seeing a created by/ modified by with the little profile picture would be supremely helpful as well. Just really hard sometimes to find a function you were
                                  • Zoho Calendar Integrated Into CRM?

                                    I've searched around the forums but couldn't find anything addressing this . . .  Is there a plan to integrate Zoho's stand alone calendar solution into Zoho CRM?  The CRM calendar does an OK job but is very basic and the Zoho calendar is great, but I've only figured out to subscribe to my CRM calendar within ZCalendar - there is no 2-way sync. My preferred solution would be for ZCal to become the default calendar/event solution within Z CRM. Is this on the roadmap? Thanks
                                  • Conditional layouts - support for multi-select picklists

                                    Hi, The documentation for conditional layouts says the following: "Layout Rules cannot be used on the following field types: Auto Number Lookup Multi Select Lookup User Lookup Formula File Upload Multi Line" I have a custom module with a multi-pick list
                                  • Can I Create Different Page Layouts Based on a Specified Module Pick List Field

                                    I am trying to work out how to create different page layouts based on a specified module pick list field value, like the Salesforce feature where you can define multiple record types and then create custom page layouts for each record type. This is a super important feature as for almost all the modules we are using (Leads, Potentials, Accounts) we need to be able only show fields relevant to the record type. E.g. We need a very different page layout for a consumer lead Vs a commercial lead, same
                                  • Scheduling Tasks in Relation to Project End Date

                                    I use Zoho project  to help manage tasks that relate to a number of specific business events that take place.  I would like to be able to have my project end date be the date of the event and then work "back" from that date to say...   Add a task 2 weeks before the project end date to remind me to XYZ.  Does anyone know if there is a way to base task timings back from a project due date rather than a project start date?
                                  • Tips & tricks: Make SalesIQ automations work for you

                                    Every day, thousands of visitors land on your website. Some browse, some buy, and some leave without a word. But, wouldn’t it be great if you could automatically know who’s interested, engage them at the right moment, and never miss a lead, and all this
                                  • Function with Search Records was working until a few weeks ago, around when "Connected Records" was released

                                    I have a custom function that has been running for nearly a year now, which suddenly stopped working around the time Zoho released the "Connected Records" update. The function is no longer finding the record using the searchRecords function. I've changed
                                  • What's New in Zoho Analytics - October 2025

                                    Hello Users! We're are back with a fresh set of updates and enhancements to make data analysis faster and more insightful. Take a quick look at what’s new and see how these updates can power up your reports and dashboards. Explore What's New! Extreme
                                  • Notes of Tasks in Zoho CRM

                                    Hello, Is there a way to filter the Notes that appear on a Task to only show the notes related to that specific Task and not display all the Notes of the objects related to that Task (Accounts, Contacts, Deal, etc). In essence, our team struggles to understand
                                  • Multi-Page Forms in Zoho Creator!

                                    Let’s make long applications easier to handle by dividing them into pages, adding a progress bar, and guiding users step by step through complex data entry. This would be a total game-changer for the user experience and could significantly boost completion
                                  • Passing the CRM

                                    Hi, I am hoping someone can help. I have a zoho form that has a CRM lookup field. I was hoping to send this to my publicly to clients via a text message and the form then attaches the signed form back to the custom module. This work absolutely fine when
                                  • Ask the Experts 24: Analytics, data administration, and mobile experience with Zoho Desk

                                    Hello Everyone! Welcome back to the Ask the Experts(ATE) series! We were so focused on our Autumn 2025 release that we didn't host an ATE session last month. In this month's ATE, we'd like to expand our areas for discussion: we'd like to listen to your
                                  • How to next stage blueprint in Zoho Creator

                                    Hello, I have question, its possible to next stage blueprint? in case, Start - (first stage) Leader 1 (with condition 1) - (second stage) Leader 2 (with condition 2) - (third stage) Leader 3 (with condition 3) - (fourth stage) After first stage, i want
                                  • Feature Request: Email Follow-Up Sequences Similar to Zoho CRM

                                    I’m wondering if Zoho Recruit is planning to introduce a feature similar to the Email Automation – Follow-Up Sequences that is available in Zoho CRM. In CRM, this allows users to send a series of timed follow-up emails triggered by specific actions (for
                                  • Associate email with a potential or project.

                                    I have a pivotal requirement to associate emails from various suppliers (contacts) with different potentials or projects, on an email by email basis as they come in. This question appears to have been raised before but I cannot find a definitive yes "it can be done". Could anyone please tell me, yes or no.  If the later I can stop wasting time and look at alternative crm systems. I would love not to have to do this. Thanks in advance.
                                  • Currency limitation when integrating Zoho CRM & Zoho Books

                                    Brief Video of Problem: https://www.loom.com/share/d61d1d07d0904e149d80c1901a22418e. Background ·       Our business is based in Australia and we have to have Zoho Books in AUD to comply with tax and reporting regulations in Australia. ·       We sell
                                  • Issue: Ticket Export Does Not Include Ticket Threads

                                    Dear Zoho Desk Support Team, I hope you’re doing well. I wanted to bring to your attention that the current ticket export feature in Zoho Desk does not seem to include the ticket threads or conversation history. When exporting tickets, only the summary
                                  • Multi-select Lookup does not have Advanced filter options in CRM

                                    With much fanfare Zoho announced the advanced filter options for CRM lookup fields which was a nice addition. This feature is not available for Multi-Select lookup fields. Will it be rolled out in the next 3-6 months, considering the standard lookup filter
                                  • Online Assessment or any aptitude test

                                    This video is really helpful! I have one question — if I share an assessment form link (through email or with the application form on my career page), how does Zoho Recruit evaluate it? Can a candidate use Google or external help while taking the test,
                                  • Unified customer portal login

                                    As I'm a Zoho One subscriber I can provide my customers with portal access to many of the Zoho apps. However, the customer must have a separate login for each app, which may be difficult for them to manage and frustrating as all they understand is that
                                  • Experience effortless record management in CRM For Everyone with the all-new Grid View!

                                    Hello Everyone, Hope you are well! As part of our ongoing series of feature announcements for Zoho CRM For Everyone, we’re excited to bring you another type of module view : Grid View. In addition to Kanban view, List view, Canvas view, Chart view and
                                  • Unable to copy into a new document

                                    Whe I create a new Writer doc and attemp to copy and past I get this message. The only way to copy into a document is I duplicate an existing document, erase the text and save it under a different name and then paste the information. Not ideal. Can you
                                  • Agent assignment filter?

                                    Godo day, We are starting to play with FSM to see if it's going to work for our needs. Now so far we have found that it's very restrcitve in the field department you you have layout rules or can't even hide fields depending on the users roles. We can't
                                  • Add Option to Mass Dispatch by User

                                    Hello! We are using the dispatch console to dispatch service appointments to our service ressources. Right now, the process is our dispatcher verifies each ressource's route for the day and dispatches it after validation. Sadly, there doesn't seem to
                                  • Kaizen #157: Flyouts in Client Script

                                    Hello everyone! Welcome back to another exciting edition of our Kaizen series, where we explore fresh insights and innovative ideas to help you discover more and expand your knowledge!In this post, we'll walk through how to display Flyouts in Client Script
                                  • Customize User Invites with Invitation Templates

                                    Invitation Templates help streamline the invitation process by allowing users to create customized email formats instead of sending a one-size-fits-all email. Different invitation templates can be created for portal users and client users to align with
                                  • Admin Control Over Profile Picture Visibility in Zoho One

                                    Hello Zoho Team, We hope you are doing well. Currently, as per Zoho’s design, each user can manage the visibility of their profile picture from their own Zoho Accounts page: accounts.zoho.com → Personal Information → Profile Picture → Profile Picture
                                  • Published Course Not Reflecting In Hub

                                    Hi! I am trying to create micro-learning courses for our team to be available for self-guided learning. I have published the courses with enrollment settings open to all users of the hub, but they don't appear to be available for enrollment. Am I missing
                                  • Unlock Locked Users via Zoho One Mobile App

                                    Hello Zoho One Team, We have noticed that in the Zoho One web admin panel, we can unlock a locked user when needed. However, when using the Zoho One mobile app, there is no indication that a user is locked, nor is there an unlock button similar to what
                                  • Is CRM On Premise available

                                    Hi Zoho team, Can you please let me know that CRM Zoho is available for On Premise as well? Thanks, Devashish
                                  • Account in Quick View Filter

                                    I have a report that I often run against a specific Account. Every time, I have to go into the edit menu and change the Advanced Filter. I would prefer to use the Quick View Filter, but it does not allow me to use the one and only field that makes any
                                  • Tip #47- Stay Ahead with Automated Scheduled Reports in Zoho Assist- 'Insider Insights'

                                    We’ve made it easier for you to stay informed, even when you’re busy managing remote sessions! With Scheduled Reports in Zoho Assist, you can now automatically receive detailed insights about your remote support and unattended access activities directly
                                  • Colour Coded Flags in Tasks Module List View

                                    I really like the colour coded flags indicating the status of the tasks assigned to a Contact/Deal in the module list view. It would be a great addition to have this feature available in the list view of activities/tasks. I understand you have the Due
                                  • UPS Label size when generated via Zoho

                                    We've integrated UPS with Zoho inventory. When creating and downloading the shipping labels they are created in a larger paper size. I'd like them to be generated to print on a 4x6 printer. Zoho have told me I need to do this within our UPS portal. UPS
                                  • Next Page