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!

----------------------------------------------------------------------------------------------------------------------------------
      • Recent Topics

      • A fresh interface and functionality improvements for Zoho CRM's data sharing settings

        Data sharing is essential for maintaining proper access controls in your CRM. Whether you're setting default permissions or defining custom sharing rules, these settings determine how records are shared among users, roles, and groups. Previously, navigating
      • Zoho CRM API, Python SDK v7 Quoted_Items

        Hello. How do I use this SDK to retrieve the Quoted_Items from a Quote and downstream the items in a Sales Order I can see references to a constant INVENTORY_MODULES_ITEMS = ["invoiced_items", "quoted_items", "purchase_items", "ordered_items"] But I cannot
      • Zoho Bookings: How to set a limit for maximum bookings per day?

        Let's say I have 1 hour slots OPEN for an entire day. What if I want all of the OPEN slots to turn OFF if/when I hit a certain number of total bookings for that day? I usually only want a total of 5 appointments to be booked but I'm not sure of the exact
      • Creating stunning templates for appointment notification emails

        Good day folks! Can you guess what we are going to check out today? We have designed a few samples to showcase the power of customizable email notification templates. Sample 1 Sample 2 Sample 3 Sample 4 Sample 5 Sample 6 Sample 7 Sample 8 Sample 9 We
      • Agents can manage the Tasks on the go, now with Zoho Desk mobile app

         Hello, Everyone!    We are elated to announce one of our most asked for features 'Tasks' in the Zoho Desk app.  Agents can now create and associate tasks with a ticket and the tasks will be listed within the corresponding tickets.   Steps to access the tasks from the app:    1. Go to a particular ticket in the app. 2. Click the Tasks icon in the 'Related Information' section.  3. List of all the tasks will be displayed.    Refer to the screenshots (Android & iOS) attached below for your better understanding:
      • How do we add Google Analytics code to Zoho Bookings scheduling pages or the thank you page?

        We need to track user activity on individual Bookings' pages and/or the thank you pages? How do we do this?
      • Ask the Experts 18: Supercharge Self-Service: Simplify Support, Empower Customers!

        Welcome to the Ask the Experts Session 18 focusing on Zoho Desk’s Self-Service features! With the AI buzzing around like busy bees, ever thought of how you can incorporate AI into Self service? Explore how Zoho Desk's Help Center, Knowledge Base (KB),
      • Custom Related List anchor tag with tel protocol

        The following code worked great for about a year to create clickable tel and mailto links in a related list in the Deals module. Just this morning, it started displaying the HTML as text. For example: <a href='tel:8882490100'>8882490100</a> Zoho support
      • Important Update: WhatsApp Marketing Template Message Restrictions for US Numbers

        Dear Zoho Forms Users, We want to keep you informed about an upcoming change in WhatsApp's marketing messaging policy that may impact your communication strategy. Starting April 1, 2025, Meta will temporarily pause the delivery of all marketing template
      • Create, Manage and Publish on Pinterest from Zoho Social

        Hey everyone,   Pinterest is our newest addition to the list of social channels that can be integrated with Zoho Social. With over 444 million users, Pinterest is one of the popular channels that people use to get inspired, share their ideas with the
      • Disable Subform Actions using Client Script Add Row, Edit, Delete

        Currently we cannot disable subform actions such as Add Row, edit row using client script It will be really beneficial if we can disable these actions from Client Script
      • Client Script: Any plans to add support for multi-select field with onChange

        Client Script is fantastic and the documentation lists multiselect form fields as unsupported. Just wondering if there are any plans to make this a supported field. https://www.zoho.com/crm/developer/docs/client-script/client-script-events.html 2. Field
      • Mass replace picklist value

        I need to rename picklist option from "Option 1" to "Option 5". The value "Option 1" is set in about 1000 records in my CRM module. I am also using the that picklist in Reports and Workflows extensively. should I: A/ rename the option value and its reference
      • Adding Default Module Image into mail merge field

        As with most people finding their way to these forums i have a specific requirement that doesn't seem to be supported by Zoho I have created 2 custom modules to suit my purpose 1 is an inventory type module that lists aluminium extrusions, and all relevant
      • Define Tab Order

        I would like the ability to define the tab order when editing or creating a new record. The only option now is for tab to go from left to right to left to right all of the way down the page. I would like to define the exact order the cursor will move from field to field. At the minimum, for a two column layout, I would like to tab down the left column and then down the right column. This actually does happen in the Contact record when you get to the mailing address section so I know it can be coded
      • Create New Tasks Layout in CRM

        I am able to do this in Leads, Contacts, Meetings, Calls - every other module, but cannot create a new layout in tasks. I have the appropriate access but it's simply not appearing as an option. Only "Standard" option shows. Please help!
      • ZohoDesk API to get conversations count of ticket

        Hi Team, I need information about ZohoDesk API that provides conversations count of ticket. Currently in ticket metrics api (https://desk.zoho.com/DeskAPIDocument#Tickets#Tickets_Getticketmetrics), it is providing only thread count, I need all conversations
      • Syncing with Google calendar, Tasks and Events

        Is it possible to sync Zoho CRM calendar, task and events with Google Calendar's tasks and events. With the increasing adoption by many major tool suppliers to sync seamlessly with Google's offerings (for instance I use the excellent Any.do task planning
      • Problem with currency field in Zoho CRM

        Hi Guys Zoho Books has a feature in currency fields that automatically converts decimal numbers with commas ( , ) to period format ( . ) when pasting them. For example: R$ 2,50 --> R$ 2.50 Is this behavior available in Zoho CRM? I couldn't find any configuration
      • Marketer’s Space - Automating CRM Actions with Journeys – Part 2

        Hello marketers! Welcome back to another post in Marketer’s Space. In our previous post, we explored how CRM actions in Journeys help marketing and sales teams work together by nurturing CRM leads and pushing only engaged prospects back to sales. If you
      • Unparsable Date when hour side is 02

        So this is a crazy error I am getting. I got this one 1-2 years ago as well, and specifically added conditional clauses to workaround that. But now I would like to create a topic and see if anyone else is getting this error. Here is how it goes: We have
      • Outlook Add-in security times out needs to login 10 times a day

        hi we've just switched the Zoho. We use Azure SSO. All users have stopped using it. Sometimes it asks every 5 minutes. What should I lot at to solve this?
      • I can't auto-scheduling calls down - the code does not change anything

        Hi, I was trying to set a function that auto-schedules calls based on their call result; i.e "Requested more info". I had also included a reminder to send an email in the code. I logged a test call and nothing changed. Is there anything wrong with the
      • WhatsApp Sandbox Integration

        Dear Zoho Team, I am currently having two questions regarding the WhatsApp integration of Zoho Desk, or more specifically the Sandbox WhatsApp integration. 1. I am unable to send replies via the API through the "Sandbox" channel. Here is some example
      • Showing ALL missing data

        Hi, When I create a chart, I noticed that even when enabling the "show missing values" option, if, let's say, the current time period will not show as "0" on the chart if there's no data (rows) in the table. For example, I have this data: Week 1: 0 rows
      • Bulk Update API

        I’m reaching out to see if anyone has updates on the bulk records feature release. We’re eager to leverage this functionality for our operations, but until it becomes available, our current API call limits are proving to be a bottleneck—even after upgrading
      • Email Integration - Zoho CRM - OAuth and IMAP

        Hello, We are attempting to integrate our Microsoft 365 email with Zoho CRM. We are using the documentation at Email Configuration for IMAP and POP3 (zoho.com) We use Microsoft 365 and per their recommendations (and requirements) for secure email we have
      • Zoho Books | Product updates | March 2025

        Hello users, We have rolled out new updates in Zoho Books to enhance your accounting experience. These include the ability to create workflow rules for manual journals and Multi-Factor Authentication (MFA) for customer and vendor portals. Explore these
      • Set connection link name from variable in invokeurl

        Hi, guys. How to set in parameter "connection" a variable, instead of a string. connectionLinkName = manager.get('connectionLinkName').toString(); response = invokeurl [ url :"https://www.googleapis.com/calendar/v3/freeBusy" type :POST parameters:requestParams.toString()
      • IMAP not working on iPhone or MAC

        Suddenly all email servers have gone offline for IMAP on two different domains. Is there a reason ? Port 993
      • How to Add a Contact to a Campaign Using Deluge Script

        Hi ZohoCommunity, I need help with adding a contact to a campaign in Zoho Campaigns using Deluge script. Specifically, I want to automatically add a contact to a campaign when the campaign name field in the contact information is filled. This field is
      • Not receiving Gmail confirmation email to send emails as Zoho account from Gmail

        Hello! I'm having an issue with the "Send mail as" option on Gmail. I am not receiving the confirmation email on my Zoho Mail account. A few days ago, it worked, then it stopped, and now when I try to fix it, I simply don't receive the confirmation email
      • Match deposits with multiple invoice payments

        I made a deposit of two customer payments (checks) so they both came in under the same deposit line through the bank account feed. How do I match this one deposit to two invoice payments?
      • There is no opton to download the Active User list in Zoho CRM Of users

        There is no opton to download the Active User list in Zoho CRM of Users
      • HTML Email in Zoho Books

        Is it possible to create custom html email template in zoho books. 
      • Meta stops WhatsApp marketing messages to U.S. numbers: What this means for your business

        Meta has always limited WhatsApp marketing messages based on user engagement with previously sent templates. Businesses may have repeatedly seen the error message “USER_MARKETING_TEMPLATE_LIMIT” when messages failed to deliver. Learn more about the restriction
      • Zoho Finance Limitations 2.0 #18: Can't Validate System Date Fields within Books (if empty)

        Throughout books there are system date fields on Purchase Orders, Sales Orders, etc... You can run validation on these BUT ONLY based on the date entered... example: it must be X days after or before Y. However you can't validate the field is a user leaves
      • How Do I Refund a Customer Directly to Their Credit Card?

        Hi, I use books to auto-charge my customers credit card. But when I create a credit note there doesn't seem to be a way to directly refund the amount back to their credit card. Is the only way to refund a credit note by doing it "offline" - or manually-
      • Bookings page very slow to load

        I recently switched to Zoho bookings from calendly and yesterday I switched back. Zoho Bookings page was taking 7-23 seconds to load. We were losing paid clicks from Google because they had to wait too long. Does anyone have any suggestions?
      • Changing Color Theme of Guided Conversations

        Hello, We have recently added Guided Conversations to one of our websites, but I am wondering if there is a way to customize the color scheme so it matches the appearance of the website? Thank you in advance!
      • Next Page