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!

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

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner




                                                            • Sticky Posts

                                                            • Kaizen #197: Frequently Asked Questions on GraphQL APIs

                                                              🎊 Nearing 200th Kaizen Post – We want to hear from you! 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 #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.
                                                            • Celebrating 200 posts of Kaizen! Share your ideas for the milestone post

                                                              Hello Developers, We launched the Kaizen series in 2019 to share helpful content to support your Zoho CRM development journey. Staying true to its spirit—Kaizen Series: Continuous Improvement for Developer Experience—we've shared everything from FAQs
                                                            • Kaizen #193: Creating different fields in Zoho CRM through API

                                                              🎊 Nearing 200th Kaizen Post – We want to hear from you! 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.
                                                            • Client Script | Update - Introducing Commands in Client Script!

                                                              Have you ever wished you could trigger Client Script from contexts other than just the supported pages and events? Have you ever wanted to leverage the advantage of Client Script at your finger tip? Discover the power of Client Script - Commands! Commands


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

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

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Show both Vendor and Customers in contact statement

                                                                                                              Dear Sir, some companies like us working with companies as Vendor and Customers too !!! it mean we send invoice and also receive bill from them , so we need our all amount in one place , but in contact statement , is separate it as Vendor and Customer, 
                                                                                                            • Pourquoi dans zohobooks version gratuite on ne peut ajouter notre stock d'ouverture??

                                                                                                              Pourquoi dans zohobooks version gratuite on ne peut ajouter notre stock d'ouverture ??
                                                                                                            • How can I adjust column width in Zoho Books?

                                                                                                              One issue I keep running into is as I show or hide columns in reports, the column widths get weird. Some columns have text cut off while others can take a fourth of the page for just a few characters. I checked report layout guides and my settings, but
                                                                                                            • Invalid value passed for file_name

                                                                                                              System generated file name does not send file anymore - what is the problem?
                                                                                                            • Custom Function for Estimates

                                                                                                              Hey everyone, I was wondering if there was a way to automate the Subject of an estimate whenever one is created or edited: * the green box using following infos: * Customer Name and Estimate Date. My Goal is to change the Subject to have this format "<MyFirm>-Estimate
                                                                                                            • This domain is not allowed to add. Please contact support-as@zohocorp.com for further details

                                                                                                              I am trying to setup the free version of Zoho Mail. When I tried to add my domain, theselfreunion.com I got the error message that is the subject of this Topic. I've read your other community forum topics, and this is NOT a free domain. So what is the
                                                                                                            • Search in module lists has detiorated

                                                                                                              Every module has a problem with the search function :-/
                                                                                                            • YouTube Live #1: AI-powered agreement management with Zia and Zoho Sign

                                                                                                              Hi there! We're excited to announce Zoho Sign’s first YouTube live series, where you can catch the latest updates and interact with our Zoho Sign experts, pose questions, and discover lesser-known features. We're starting off by riding the AI wave in
                                                                                                            • Search in module lists has detiorated

                                                                                                              Every module has a problem with the search function :-/
                                                                                                            • Add Zoho Forms to Zoho CRM Plus bundle

                                                                                                              Great Zoho apps like CRM and Desk have very limited form builders when it comes to form and field rules, design, integration and deployment options. Many of my clients who use Zoho CRM Plus often hit limitations with the built in forms in CRM or Desk and are then disappointed to hear that they have to additionally pay for Zoho Forms to get all these great forms functionalities. Please consider adding Zoho Forms in the Zoho CRM Plus bundle. Best regards, Mladen Svraka Zoho Certified Consultant and
                                                                                                            • Bigin: filter Contacts by Company fields

                                                                                                              Hello, I was wondering if there's a way to filter the contacts based on a field belonging to their company. I.e.: - filter contacts by Company Annual Revenue field - filter contacts by Company Employee No. field In case this is not possibile, what workaround
                                                                                                            • Has Zoho changed the way it searches Items?

                                                                                                              Right now all of our searches have broken and we can no longer search using the SKU or alias. It was fine last night and we came in this morning to broken.....this is impacting our operations now.
                                                                                                            • Refunds do not export from Shopify, Amazon and Esty to Zoho. And then do not go from Zoho inventory to Quickbooks.

                                                                                                              I have a huge hole in my accounts from refunds and the lack of synchronisation between shopify , Amazon and Etsy to Zoho ( i.e when I process a refund on shopify/ Amazon or Etsy it does not come through to Zoho) and then if I process a manual credit note/
                                                                                                            • CRM->INVENTORY, sync products as composite items

                                                                                                              We have a product team working in the CRM, as it’s more convenient than using Books or Inventory—especially with features like Blueprints being available. Once a product reaches a certain stage, it needs to become visible in Inventory. To achieve this,
                                                                                                            • Monthly timesheet, consolidation of time by project

                                                                                                              I have time logs for various jobs for project. Is it possible to consolidate the time spent for each job, when I am generating a timesheet for a month? I am getting the entries of jobs done on each day when I generate a timesheet for a month For example
                                                                                                            • Sending emails from an outlook account

                                                                                                              Hi, I need to know if it's possible to send automatic emails from an Outlook account configured in Zoho CRM and, if so, how I can accomplish that. To give you some context, I set up a domain and created a function that generates PDF files to be sent later
                                                                                                            • Is there a way to associate an email in ZOHO Main to a Vendor record in ZOHO CRM

                                                                                                              My situation is as below, I have a vendor in ZOHO CRM lets say "Vend A" and an associated contact, "Cont A" If Cont A sends me an email using the email I've registered in the contact record the standard OOTB email sync will work. But the vendor has some
                                                                                                            • Struggling with stock management in Zoho CRM – is Zoho Inventory the solution?

                                                                                                              My biggest pain point today with Zoho is inventory management. I run a retail business and reliable stock management is absolutely critical. Obviously, I need this inventory to be visible inside the CRM. At first, I tried handling it through custom modules
                                                                                                            • Automating CRM backup storage?

                                                                                                              Hi there, We've recently set up automatic backups for our Zoho CRM account. We were hoping that the backup functionality would not require any manual work on our end, but it seems that we are always required to download the backups ourselves, store them,
                                                                                                            • Nimble enhancements to WhatsApp for Business integration in Zoho CRM: Enjoy context and clarity in business messaging

                                                                                                              Dear Customers, We hope you're well! WhatsApp for business is a renowned business messaging platform that takes your business closer to your customers; it gives your business the power of personalized outreach. Using the WhatsApp for Business integration
                                                                                                            • can't login Kiosk URGENT

                                                                                                              already try, can't login pls help to support. thanks.
                                                                                                            • Zoho Calendar not working since a few days

                                                                                                              Hey there, first off a minor thing, since I just tried to enable the Calendar after reading this in another topic (there was no setting for this though) : For some reason my current session is showing me based in New York - I'm in Germany, not using a
                                                                                                            • Granular Email Forwarding Controls in Zoho Mail (Admin Console and Zoho One)

                                                                                                              Hello Zoho Mail Team, How are you? At present, the Zoho Mail Admin Console allows administrators to configure email forwarding for an entire mailbox, forwarding all incoming emails to another address. This is helpful for delegation or backup purposes,
                                                                                                            • 【Zoho CRM】CRM for Everyoneに関するアップデート:関連データ機能

                                                                                                              ユーザーの皆さま、こんにちは。コミュニティチームの中野です。 今回は「Zoho CRM アップデート情報」の中から、CRM for Everyoneの新機能「関連データ機能」をご紹介します。 関連データ機能は、あるタブのデータを別のタブに柔軟に関連付け、異なるタブで管理されている情報を1か所にまとめて表示できます。 たとえば、組織タブとチームタブのデータを関連付けることで、必要な情報に効率よくアクセスでき、顧客理解を深めながら他チームとの連携もスムーズに行えます。 目次 1. 関連データの設定方法
                                                                                                            • Inventory to Xero Invocie Sync Issues

                                                                                                              Has anyone had an issue with Invoices not syncing to Xero. It seems to be an issue when there is VAT on a shipping cost, but I cannot be 100% as the error is vague: "Unable to export Invoice 'INV-000053' as the account mapped with some items does not
                                                                                                            • How to activate RFQ? What if a price list has ladder price for items?

                                                                                                              Where can I find the option to activate request for quotation? How does it work? If the item has ladder price, does it gets calculated depending on how many items are in the cart?
                                                                                                            • Cannot access KB within Help Center

                                                                                                              Im working with my boss to customize our knowledge base, but for some reason I can see the KB tab, and see the KB categories, but I cannot access the articles within the KB. We have been troubleshooting for weeks, and we have all permissions set up, customers
                                                                                                            • Can't join canal Developers Zoho User

                                                                                                              Hello, I received an invitation to join this channel, but I get an error when I try to join it, and I get the same error when I go to the Zoho Cliq interface > Search for a channel. Is this because I don't have a license linked to this email address?
                                                                                                            • Desk Email reply - set default font / use custom font

                                                                                                              Hello, in our e-mails, which we send to our customers, a certain font must be used (Corporate Design): Segoe UI https://en.wikipedia.org/wiki/Segoe#Segoe_UI How can this be included? How can this be set as the default font to ensure that this font is
                                                                                                            • PDF Templates - Checkbox Borders

                                                                                                              Is there a way to remove the border of a radio/checkbox on a PDF? I'd like to use the function of checkbox but if there's no easy way to remove the border (the PDF form already has a rectangle so it gets cluttered), then I'm forced to create a single
                                                                                                            • Zoho CRM's custom views are now deployable from sandboxes

                                                                                                              This feature is now available for users in the AU, JP, and CN DCs. New update: This feature is now available for users in CA and SA DCs. Hello everyone, We're excited to announce that you can now deploy custom views from sandboxes to your production environment
                                                                                                            • Zoho Devops

                                                                                                              We have a Zoho one account which we have integrated with an SAS educational product, sold on a subscription model, using webhooks and API calls. We make some use of custom fields and cross module lookups and relationships. We utilize CRM, Books and billing
                                                                                                            • Generate a link for Zoho Sign we can copy and use in a separate email

                                                                                                              Please consider adding functionality that would all a user to copy a reminder link so that we can include it in a personalized email instead of sending a Zoho reminder. Or, allow us to customize the reminder email. Use Case: We have clients we need to
                                                                                                            • Settings Icon No Longer in ZOHO Desk?

                                                                                                              In ZOHO desk, there has been a gear icon for settings. as of yesterday, it is no longer there. I showed up briefly this morning but is gone again. Anybody else experiecing this?
                                                                                                            • Introducing the all-new email parser!

                                                                                                              Greetings, We are pleased to introduce to you, a brand-new, upgraded version of the Zoho CRM Email Parser, which is packed with fresh features and has been completely redesigned to meet latest customers needs and their business requirements. On that note,
                                                                                                            • Tables for Europe Datacenter customers?

                                                                                                              It's been over a year now for the launch of Zoho Tables - and still not available für EU DC customers. When will it be available?
                                                                                                            • Tip #43 - Track, Review, and Analyze Your Assist Sessions with Reports-'Insider Insights'

                                                                                                              Did you know you can generate detailed reports for both remote support sessions and unattended access sessions in Zoho Assist? This makes it easy to monitor technician activity, measure efficiency, and review customer interactions. Let us now take a closer
                                                                                                            • Kaizen #190 - Queries in Custom Related Lists

                                                                                                              Hello everyone! Welcome back to another week of Kaizen! This week, we will discuss yet another interesting enhancement to Queries. As you all know, Queries allow you to dynamically retrieve data from CRM as well as third-party services directly within
                                                                                                            • Can we generate APK and IOS app?

                                                                                                              Dears, I want to know the availability to develop the app on zoho and after that .. generate the APK or IOS app  and after that I added them to play store or IOS store.. Is it possible to do this .. I want not to use zoho app or let my customers use it. thanks 
                                                                                                            • Simplified Call Logging

                                                                                                              Our organization would like to start logging calls in our CRM; however, with 13 fields that can't be removed, our team is finding it extremely cumbersome. For our use case, we only need to record that a call happened theirfor would only need the following
                                                                                                            • Next Page