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!

----------------------------------------------------------------------------------------------------------------------------------
    • Sticky Posts

    • 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.
    • Kaizen #226: Using ZRC in Client Script

      Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
    • Kaizen #222 - Client Script Support for Notes Related List

      Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how
    • Kaizen #217 - Actions APIs : Tasks

      Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
    • Kaizen #216 - Actions APIs : Email Notifications

      Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are
    • Recent Topics

    • Deactivate Zoho CRM for everyone

      We would like to deactivate Zoho CRM for everyone. How can we do that?
    • Best sales insights for target accounts?

      Question for all the sales power-users out there: I would like to gain insights from Zoho CRM for a rotating list of target accounts. Each Outside Salesperson has 5 target accounts, and they can change these targets quarterly with management approval.
    • Building extensions #2: Publishing and sharing Zoho Sprints extensions using Sigma Cloud Editor

      Welcome to a new post on Zoho Sprints extension development! In our last post, we explored how to create, test, and edit an extension for Zoho Sprints. In this post, we'll take a look at how to publish and share an extension. Publishing and sharing extensions
    • Custom return paths

      How do I delete a custom return path subdomain created in error?
    • How do you paginate in schedule function

      How does someone paginate in schedule function in deluge is there an ideal way to do this apart from hardcoding max pages
    • Mail bounces due to bad reputation

      Good evening. I'm seeing these errors from both hotmail/outlook and yahoo, as well as hard bounce from Virgin Media and talktalk for some time now. Bounce category: Connection issues Reason: uncategorized-bounce Message: 4.7.650 The mail server [136.143.188.237]
    • What is a realistic turnaround time for account review for ZeptoMail?

      On signing up it said 2-3 business days. I am on business-day 6 and have had zero contact of any kind. No follow-up questions, no approval or decline. Attempts to "leave a message" or use the "Contact Us" form have just vanished without a trace. It still
    • Calendar in Global View

      When you are working with multiple projects, staying on track with all project activities requires a centralized view of all your project activities. Especially in a work environment, users tend to miss out on their day-to-day activities when it doesn't
    • My email sending has beed blocked due to high bounce rate. NEED HELP

      User ID: 886739811 Dear Zoho Team, I hope this message finds you well. My account (User ID: 886739811) was blocked from sending emails last week due to an unusually high bounce rate. This spike was caused by a bot attack on our platform, which led to
    • 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
    • How to Migrate from MDaemon to Zoho Mail Account?

      Hi there, Zoho Mail is one of the most popular as well as leading competitor for several cloud email service providers. It is It provide cloud email service as well as desktop based email client. In recent years people are migrating from third party cloud servers to Zoho Mail. The reasons are plenty, i.e. the user interface, security, high performance and many countless amazing features. On the other hand MDaemon Mail (aka WorldClient) is also popular among cloud email servers. But there are some
    • Ask the Experts: A Live Q&A Session

      We’re back with another exciting edition of the Ask the Experts series, this time exclusively for our Zoho Recruit users from the USA & Canada regions! Whether you're trying to configure your account better, have questions about customization, or want
    • Tip #7: Customize the appointment confirmation page

      A confirmation page plays a crucial role in creating the first impression, as that's where customers land when booking with you. It shows your brand identity, engages your audience, and drives more conversions. Yet, this section is often overlooked when
    • Add Image Upload Field to Zoho Bookings Registration Form

      Hi, We would like to request the addition of an image upload field to the Zoho Bookings registration form. Currently, Zoho Bookings only supports text-based fields (e.g., Single Line, Multi-Line, Email, Checkbox, Dropdown, Radio Button, and Date), but
    • Meeting integration with Otter.ai

      Would love for an integration with an AI transcription service like Otter.ai to be integrated with Zoho Meeting. Thanks
    • [Free webinar] AI agents in Zoho Creator - Creator Tech Connect

      Hello everyone, We’re excited to invite you to another edition of the Creator Tech Connect webinar. About Creator Tech Connect The Creator Tech Connect series is a free monthly webinar featuring in-depth technical sessions designed for developers, administrators,
    • プロフェッショナルプランで、見積作成時に原価と利益率を確認する代替案について

      現在、Zoho CRMのプロフェッショナルプランを利用しています。 海外から輸入した商品を販売しており、商品ごとに原価が異なるため、見積書を作成する際(または保存直後)に、その見積の原価合計と利益率を確認したいと考えています。 しかし、現在のプランではDeluge(関数)が使えず、見積書の「商品詳細」の項目をカスタマイズすることもできません。 1,見積作成画面で商品の原価を参照できるような、標準機能での工夫はありますか? 2,レポート機能を使って、見積単位での原価・利益を算出する方法はありますか?
    • Announcing Zoho Sheet desktop app for macOS and Windows (Beta)

      Hello Sheet users, We know you’ve been waiting for this one. It has always been the top priority on our roadmap to provide a single native desktop app for macOS and Windows that works both online and offline. Today, we are excited to announce that the
    • How to create a directory report from one-to-many relationship

      Hi all, Newbie here. I'm converting an Access DB to Creator. I've learned Forms are tables and Reports are used to edit table rows, not Forms. I've got the data loaded and can maintain it with the Reports already done. I've done filtering and sorting,
    • Moving Project Task to other parent not possible

      We are trying to move an existing Zoho Projects task to a different parent task via API. Example: Task ID: 289214000001385113 Current parent: 289214000001281044 New parent: 289214000001281045 We tested updating the task with: taskParam.put("parent_task_id",
    • Remove or hide default views

      I'm looking to only have the views pertinent to my organization. Is there a way to show only my custom views (or separate them to a different area or something)? If not, this should be a feature as switching from Zendesk we had this option...
    • Add more than 7 sender addresses in campaigns

      I need to add at least 15 sender email addresses but am currently limited to 7. Please can you increase. Thank you
    • Email sent to Hotmail arrives to Spam

      I'm sending email tests to my Hotmail account and they arrives to the Spam folder all the time. My domain has been verified correctly. How can I fix it?
    • Let’s Talk Recruit: Your pipeline is full. So why aren’t roles closing?

      Welcome back to Let’s Talk Recruit, where we break down hiring workflows into simple, actionable insights for recruiters. The focus this month is on what slows down your pipeline even when everything looks like it’s working. Picture this. You log in to
    • Mirror Component in Zoho CRM: Access real-time related data without leaving your record

      Hi everyone, This feature is now available for the JP, CA, SA, UAE, and AU DCs. We're excited to bring to you Zoho CRM's mirror component, which presents relevant data on a record's details page and keeps everything users need in one place without having
    • Search through email contents

      Is there a way to search through the email history of a lead? Meaning if among the 50 emails to a lead about different topics I want to find all the ones with the word "pizza" in the body of the email, is that possible? Thanks for your help, Hanan
    • Marketing Tip #9: Track your traffic sources

      Not all marketing channels work equally well. Knowing whether your visitors come from Google, Instagram, or email helps you focus on what actually drives sales. Try this today: Check your Zoho Commerce reports or connect Zoho PageSense to see your top
    • It Really Can Be This Simple

      Let's be honest.... Running a business already comes with enough moving parts. Invoices, payments, follow-ups, reminders, tracking who paid and who disappeared. It can slowly turn into a full-time admin job on its own, especially when you are a Sole Proprietor,
    • Huge confusion in zoho crm and zoho analytics

      Context => We have reporting based hierarchy in zoho crm and basically there will be one sales head and couple sales managers and 10 pre sales excutives divided between 2 sales managers we have maintained that in zoho crm and there is complex reporting
    • Zoho Books | Product updates | May 2026

      Hello users, We're back with the latest updates and enhancements we've rolled out in Zoho Books. From sales tax automation to scanning receipts for free, explore the updates designed to upgrade your bookkeeping experience. Sales Tax Automation [US & Canada
    • Update: [Issue fixed] Temporary access issue on Android and iOS devices

      Hello, Zoho Sheet users! We're aware that some of you are currently unable to open spreadsheet files from your Android and iOS devices. We extend our sincere apologies for the inconvenience caused. We're working on fixing the issue with highest priority
    • Action Required: Migrate Your SQL Server Connection

      Dear Users, Following our earlier communication on the upcoming Zoho Analytics security updates affecting Microsoft SQL Server connections, we have revised our recommended approach. The previously shared cipher suite configuration is no longer the recommended
    • Currency Change for Companies

      Hello FSM Team, We would like your assistance in changing the company currency for our UAE organization from AED to USD. Currently, all customers and users are configured with AED currency settings, and we would like to standardize the organization currency
    • Accrual Data - Zoho Books API

      Hi Team, When we integrate Zoho Books with Zoho Analytics, we usually receive a consolidated dataset called “Accrual Transactions,” which contains all types of transaction data. Could you please confirm whether it is possible to retrieve this same data
    • Bank Fees - Allow User to Choose Expense Account

      Bank fees from Customer Payments can only be debited against the system Bank Fees account due to hard-coding. The user should be able to select which expense account those fees are debited against. The use case is pretty straightforward. A business like
    • Showing Cost Price and Profit Margin in PDF

      Hi there, We use two different types of quotes in our company. One is a version for our clients that does not include cost or profit margin information, and the other is for our internal team that includes profit margin and cost. We are running into an
    • Side bar menu

      It would be great if you could stop the auto collapse of expanded menus when selecting a different module. It would save a lot of mouse clicks for a lot of users that frequently switch between sales & purchases as we do, it's easier to collapse them manually when not required !
    • Syncing zoho books into zoho crm

      I was wondering how I can use zoho books in crm as I have been using them separately and would like to sync the two. Is this possible and if so, how? Thanks
    • Remove horizontal scroll bar

      Is there any way to remove or hide the horizontal scroll bars on the iframe reports? I removed columns, but it still stays there.
    • Rich Text Type Format for Notes Field

      Has it been discussed or is there a way to insert a table in the notes field? We sometimes receive information in a table format, and it would be beneficial to have it in the same format as a note on a record. Moderation Update (12-May-26): We are working
    • Next Page