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

- Input the ID of the contact and click Save.
- 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:
- Create a CRM - Module type query for the Deals module.
- Choose Contacts as the Related Module.
- Select the fields from these two modules that you want to retrieve.

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

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

- Click Save and click Next.
- 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!
----------------------------------------------------------------------------------------------------------------------------------

See Also
Recent Topics
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
a question about the COQL API v8
When I specify eight or more values in a WHERE IN clause and execute it, an error occurs. Is there a limit to the number of values that can be specified in a WHERE IN clause? ↓Error select * FROM Vendors WHERE (id in (1, 2, 3, 4, 5, 6, 7, 8, 9)) ↓Success
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
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
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
Next Page