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
Bring your own credentials (BYOC) for connections in Zoho Creator
Hello everyone, We're excited to announce an important step forward in how integrations and authentications work in Zoho Creator. Zoho Creator is a versatile platform for integrations, enabling you to connect with thousands of third-party services using
CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive
Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
Project Management Bulletin: March, 2026
We are passionate about equipping our users with efficient solutions that help them run their businesses successfully. Our collective efforts over the past 2 years have culminated in the launch of Sprints 3.0— built with reliable features, impactful integrations,
Composite items inside of composite items; bill of materials needed
Hi Zoho and Everyone, I am evaluating whether Zoho Inventory will work for my small business. I grow and harvest herbs and spices but also get from wholesalers. I use all these items to make herbal teas, but also sell them as individual items on my Shopify store and Etsy. I discovered the composite item bundling and am wondering if I could get some assistance since there is no bill of materials: Our herbal company's best selling tea is a sleepytime tea. Sleepytime Tea can be purchased in three weights
Automation Series: Sync Task Status with Zoho Desk Tickets
In Zoho Projects, you can automatically close and reopen an associated Zoho Desk ticket when the status of a task is changed. This syncs the current state of the task with the support ticket without manual updates. For instance, a support team handling
Auto-Generate Line Numbers in Item Table Using HTML & CSS Counters (Zoho Books & Zoho Inventory Custom Templates)
<div> <style> /* Start counter from 0 inside tbody */ tbody#lineitem { counter-reset: rowNumber; } /* Increment counter for each row */ tbody#lineitem tr { counter-increment: rowNumber; } /* Show counter value in first column */ tbody#lineitem tr td:first-child::before
Does zoho inventory need Enterprise or Premium subsrciption to make Widgets.
We have Zoho One Enterprise and yet we can't create widgets on inventory.
Introducing Radio Buttons and Numeric Range Sliders in Zoho CRM
Release update: Currently out for CN, JP, AU and CA DCs (Free and standard editions). For other DCs, this will be released by mid-March. Hello everyone, We are pleased to share with you that Zoho CRM's Layout Editor now includes two new field formats—
New UI for Writer - Disappointed
I've been enjoying Zoho Writer as a new user for about 6 months, and I really like it. One of my favorite things about it is the menu bar, which you can hide or leave out while still seeing most of your page because it is off to the left. I think this
Zoho CAMPAIGNS working hours
Hi I use Campaigns Automation workflows to automate follow-ups to my Leads. I discovered this weekend that emails are being sent out on Sundays. How do I limit my Campaigns outgoing emails to business working hours? This is very important! Thanks, D
Depositing funds to account
Hello, I have been using Quickbooks for many years but am considering moving to Zoho Books so I am currently running through various workflows and am working on the Invoicing aspect. In QB, the process is to create an invoice, receive payment and then
Create Receipt of a Donation (not a sale)
We are a non-profit organization that receives general donations. How do I create a receipt of payment for the donor and categorize the payment as a Gift? I tried the method of creating an invoice; however that automatically created a "Sales" transaction
Function #2: Create a Deal in Zoho CRM when an Estimate is created in Zoho Books
For those who use Zoho CRM integrated with Zoho Books, here's a nifty function that helps you optimize your sales process by adding a Deal in Zoho CRM whenever an estimate is created in Zoho Books. Custom Function: To create the custom function, go to
New Custom View -Sorting the Custom fields
While creating a New Custom View in invoice , Customers, Bills ,expense etc , the sorting of custom fields are not available , a query function "order by / sort by " may also be included in Define new criteria module which will be more beneficial to
Grouping Undeposited Funds to Move to other accounts
In the bank option it would be nice to check what transactions in undeposited funds I want to move to other accounts. Then while checking this it can accumulate totals and created whats essentially a deposit slip. Once the transaction is moved it should
Finding rhythm through poetry
Poetry has long been a powerful form of expression, discovery, and reflection. For many, it is a way to pen down their thoughts and experiences. The "poetic license" allows writers to shape their words with rhythm and flow. This year, on World Poetry
Sync your CRM Tasks with Zoho Projects
Zoho Projects integration with Zoho CRM helps you manage your tasks more efficiently. You can create all project related activities right inside your CRM using this integration. Create new portal or associate an existing portal, add projects to the portal,
Zoho CRM strips whitespace in text fields
When editing field text with multiple spaces: CRM - both UI and API trim / compress the whitespace to a single space when saving: Is this known / expected / documented behaviour?
WorkDrive API returning empty response even after placing file in Team Folder
Hi everyone, I am trying to fetch a file from Zoho WorkDrive using a Deluge standalone function in Zoho People. The API call executes successfully using a configured connection, but the response is coming back empty. I have verified the following: The
Custom Button makes scroll bar go down in report
I have a report with a Custom button called Completed. A colleague mentionned to me that when he pressed this custom button it scrolled down the page which is annoying since he want to stay at the same space on the repoort. There is no reload linked to
Quickbooks Integrations Stopped Working
All of our Quickbooks integrations have stopped working. I am checking in to see if: a) this is a known issue b) if anyone else is having this issue. As usual, Zoho support is unavailable.
sync two zoho crm
Hello everyone. Is it possible to sync 2 zoho crm? what would be the easiest way? I am thinking of Flow. I have a Custom Module that I would like to share with my client. We both use zoho crm. Regards.
CRM x WorkDrive: We're rolling out the WorkDrive-powered file storage experience for existing users
Release plan: Gradual rollout to customers without file storage add-ons, in this order: 1. Standalone CRM 2. CRM Plus and Zoho One DCs: All | Editions: All Available now for: - Standalone CRM accounts in Free and Standard editions without file storage
Incorrect Functioning of Time Logs API (Version 3)
We need to fetch the list of time logs for each task for our company internal usage. We are trying to achieve it by using the next endpoint: https://projects.zoho.com/api-docs#bulk-time-logs#get-all-project-time-logs Firstly, in the documentation the
Zoho CRM Queries Now Support Databases and Cloud Data Sources
Hello everyone! We're thrilled to announce a major enhancement to the Queries feature in Zoho CRM! Queries now support a broader range of external data sources, allowing you to fetch live data and combine it with CRM records, all using a unified query
Salesforceに添付ファイルを格納したい
お世話になっております。 Salesforceに添付ファイルを格納したく、カスタムオブジェクトに連携し、 「ファイルのアップロード」項目を設けました。 実際、エラーもなく送信出来たのですが、実際生成されたカスタムオブジェクトのレコードを見ると、どこにも添付ファイルがありません。仕様として、この添付ファイルはSalesforceのどこに格納されるのでしょうか? 今回作りたいフォームは、複数の書類を添付するため、Zohoformのファイルアップロード項目「本人確認書類」「源泉徴収票」などの項目を、Salesforce側にも設けた「本人確認書類」「源泉徴収票」という各項目にURLリンクとして紐づけたいと思っておりました。
Dynamic image in form works in the app but not on the customer portal.
img = frm_Fichas[ID == input.Nombre].Foto; imgno = Nophoto[ID2 = 1].Image; if(len(img) > 1) { img = img.replaceAll("/sharedBy/appLinkName/",zoho.appuri); img = img.replaceAll("viewLinkName","Fichas_de_personal_public"); img = img.replaceAll("fieldName","Foto");
Is it possible to retrieve function (Deluge) code from Zoho CRM externally?
Hi Everyone, Is it possible to fetch or retrieve the Deluge function code from Zoho CRM using an external method (API or any other approach)? I would like to know if there is any way to access or extract the function script outside of Zoho CRM, or if
Uplifted homepage experience
Editions: All editions. Availability update: 17th February 2026: All editions in the CA and SA DC | JP DC (Free, Standard and Professional editions) 23 February 2026: JP (All Editions) | AU, CN (Free, Standard, Professional editions) 27 February 2026:
Darshan Hiranandani : How many participants can join a Zoho Meeting at once?
Hi everyone, I'm Darshan Hiranandani, trying to find out the maximum number of participants that can join a Zoho Meeting at once. Has anyone here used Zoho Meeting for larger groups and can share their experience or knowledge about the participant limit?
Where is the scheduled report in New UI?
Hi Team, Seems there is not such a field in New UI, hence I have to switch to old UI to handle request..
Approval Workflow for Purchase Orders Abrir
The requirement is , that all purchase orders greater than or equal to 5000 go through an approval process from certain people, but within books I only see that the approvers can be by levels or any approver but we cannot enter a rule like these. Can
WeTravel + Zoho CRM Integration - Has Anyone Built a Connector or Extension?
Hi all, I'm exploring options for integrating Zoho CRM with WeTravel (booking & payment platform for tour operators). Zapier seems to be the common method but seems limited. I'm wondering if anyone in the community has developed a more comprehensive solution,
Option in pipeline deal to select which hotel or branch or store if client has more than one local store
Hi, I would like to know if there is an option in the deal pipeline to select which hotel, branch, or store a deal is related to—if the company has more than one location. For example, I have a client that owns several hotels under the same company, and
Undo article like/dislike
It seems to be not possible to undo your like/dislike for an article. Would be great if you can. Kind regards, Helen
Nested notebooks
Dear Sir/Madam, I would like to know if it is possible to nest notebooks. It would be very helpful when there are too many, as it would improve organization. Thank you for your response. Best regards.
Tax in Quote
Each row item in a quote has a tax value. At the total numbers at the bottom, there is also a Tax entry. If you select tax in both of the (line item, and the total), the tax doubles. My assumption is that the Tax total should be totalling the tax from
Issue with "Send Email" from Quotes not loading Email Template data
Hi everyone, I'm currently experiencing an issue when using the "Send Email" option from a Quote record in Zoho CRM. What’s happening: When I go to the Quotes module and select a record, then click Send Email, the attached file (Quote) correctly pulls
Dynamically Fetching Lookup Field Display Value
I have an audit trail form, Audit_Changes, that tracks old vs new values across different forms. For lookup fields, the old/new value is the ID, but I also need the display value. What's a best practice for dynamically fetching the display value of the
Stop Scrolling, Start Asking: Meet Zia for Your Files
Hey everyone 👋 The era of 'scrolling and searching' is officially over. Whether it's a dense legal contract or a long meeting recording, searching for specific details is a massive time-sink. We think you should be able to interact with your files, not
Next Page