Kaizen 166 - Handling Query Variables in Zoho CRM

Kaizen 166 - Handling Query Variables in Zoho CRM


Hello, Code Enthusiasts! 

Welcome to another week of Kaizen!

This week, we'll dive into handling variables in Zoho CRM Queries and see how they can be deployed in Kiosk to dynamically retrieve data. This technique is especially useful for integrating data from third-party applications or CRM itself into your custom interface, such as Canvas and Kiosk. 

Variables

Variables are placeholders in Queries that are replaced with real values at runtime. Instead of hard coding data, you can use variables to make your Queries flexible and reusable.

Syntax: {{Variable_Name}}

Query variables in Zoho CRM function differently from conventional Zoho CRM variables. While CRM variables act as containers for dynamic values that can be stored and reused anywhere within the organization, query variables are designed to receive their values at runtime.

Query variables enhance flexibility and are specifically used in:
  • COQL: To dynamically filter and retrieve data.
  • REST API: For runtime data fetching based on specific parameters.
  • Query Criteria: To define conditions dynamically for fetching records.

How to Use a Variable?

To use variables, ensure the fields providing the variable values are available in the context where the Query is executed.

Let’s say you want to evaluate a marketing campaign's performance. For this, you need to fetch all leads with a specific lead source. Since each campaign is associated with a different lead source, you can define the lead source as a variable. When viewing a campaign's details, the lead source will be passed dynamically to the Query.

Business Scenario : Nearby Delivery Hubs

Imagine a telecommerce platform using Zoho CRM to manage sales and deliveries. When a customer provides their PIN code, the salesperson must confirm with the customer for a nearby post office for package pick-ups and drop-offs in Kiosk.

With Zoho CRM Queries, you can achieve this by dynamically fetching the nearby post offices list based on the customer's PIN code and displaying it on the Contact record’s detail page. Here's how to set it up using the Kiosk feature.

Setting Up the Query in Kiosk

1. Access Kiosk Studio

  • Log in to Zoho CRM.
  • Go to Setup > Customization > Kiosk Studio and click Create Kiosk.

2. Configure the Current Module

  • Choose the module where the Kiosk will be deployed.
    For this example, select Contacts to use the PIN code from the Contact record.

  • Configuring this Current Module is mandatory to use variables from the current record. 

3. Add a Screen

  • Click the + icon on the flowchart and select Screen.
  • Name the screen and click Add.

4. Add a Query

  • Under Display Elements, choose Get Data Via Queries.
  • Click New Query and then Add Query to create a new one.

5. Set Up the Data Source

  • Any custom source has to be enrolled either in the Trusted Domains or in the Connections. For demo, 
  • In the Add Query pop-up, click Source and create a new source.
    For this demo, we’ll add India Post to fetch post offices based on PIN codes.
  • Add default Headers and Parameters to the source if any. This will be added by default whenever the source is used in a query. 

6. Define the Query

  • In the Information section, provide the query’s Name and API Name to refer to the query wherever needed.
  • Use the endpoint URL with a variable, e.g., https://api.example.com/post_offices/{{Mailing_Zip}}.
  • You can add headers and parameters specific to the query, but let us skip that for the demo. 
  • Add a JavaScript serializer to process the Query response. For our case, we will serialize the response with return result[0].PostOffice;
  • You can test your serializer with the help of Preview. Once finished, provide a test value to the variable for generating Schema for the Query Response.
    The test value you provide is temporary and not permanent. The value of a variable will be declared using merge fields when you associate the query with a component. Check Step 7 to know how it is used in our demo. 

    You can also manipulate the response by changing data types of keys in the raw response. To keep the demo simple, let's go with the raw response. 

7. Link the Query to Kiosk

  • Use Dynamic Parameters to map the variable to the Mailing Zip field from the Contact record. Enter # to merge the fields. 
  • In Choose Fields, select which data to display in the Kiosk.
  • You can further manipulate the query response in the Record Preferences section.
    Select your preference to view the response as a Single Record or Multiple Records.
    • For Single Record, choose the data that has to be displayed from the query response and click Save.
    • For Multiple Records, fill in the following details as shown in this image. 
    • The Selection Limit helps you with the maximum number of records that have to be chosen in the kiosk after publishing. 
    • Identifier field functions as the primary field to identify each record. 
    • In the fields section, choose the data that has to be displayed from the query response.

  • Customize the Kiosk button and click Done to save your configuration.
  • 8. Test and Publish

    Test the Kiosk using a sample Record ID from the Contacts module. If successful, the list of nearby post offices will display in an iframe as it would appear on the Contact detail page.


    Once satisfied, publish the Kiosk to make it live. 
    Let us check the Kiosk from the Contacts detail page. 

    Example Scenarios

    • Loan Approval: You can display a customer's CIBIL score using their Social Security Number (SSN) directly within a Canvas. The SSN serves as a runtime variable, allowing you to approve loans without manual data entry and shifting tabs.
    • Customer Support: In a Records Detail View kiosk, display all high priority tickets linked to an account. The current account's ID acts as a runtime variable, ensuring that support agents have immediate access to relevant queries and resolve issues faster.
    • Insurance Verification: In a Records Detail View kiosk, the customer's ID proof number can be used to verify their details on official government sites. The ID proof number dynamically functions as a variable, streamlining the insurance verification process.
    We hope you found this post informative and beneficial.

    If you have any queries or a topic to be discussed, reach out to us at support@zohocrm.com or drop your comments below. 

    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

                                                                                                              • FSM trying again

                                                                                                                have not linked FSM yet to the rest of out Zoho suit. It certainly looks like the apointment and service part is more manageable for our staff. The question is that our engineers multi task examples 1. deliver products to customers not fitted 2. Service
                                                                                                              • Possible to bold or indent text in the description field?

                                                                                                                As part of one item, I often have a detailed description that would be much easier to read if there was the ability to have a bulleted list or bold text and the like. Is this possible? My last invoicing software allowed markup in the field so, for example, an asterisk meant a bullet. I haven't been able to find any documentation related to this.  Any information would be appreciated. Thank you.
                                                                                                              • in zoho creator Sales Returns form has sub form Line Items return quantity when i upate the or enter any values in the sub form that want to reflect in the Sales Order form item deail sub form field Q

                                                                                                                in zoho creator Sales Returns form has sub form Line Items return quantity when i upate the or enter any values in the sub form that want to reflect in the Sales Order form item deail sub form field Quantity Returned\ pls check the recording fetch_salesorder
                                                                                                              • How can I setup Zoho MCP with Chat GPT

                                                                                                                I can set up custom connections with Chat GPT but I cat an error when I try to set it up. The error is: "This MCP server can't be used by ChatGPT to search information because it doesn't implement our specification: search action not found" Thoughts?
                                                                                                              • Formatting of Balance Sheet and Profit & Loss Reports

                                                                                                                The default format of the Balance Sheet and P&L Reports are based on the Account Types and then the individual accounts within the Chart of Accounts. These are then ordered alphabetically under these sub-headings and one is unable to re-order these or
                                                                                                              • UK MTD reports concerning turnover and cerash accounting

                                                                                                                Hi I am a sole trader, and I have just started with Zoho Books in order to comply with the new HMRC requirements. I use 'cash basis' - which I understand to mean that income is when the cash comes in (not the invoice date) and expenses are when they are
                                                                                                              • Retainer Invoice.

                                                                                                                Why ZOHO not have facilities to deduct partially advance payment from an invoice.
                                                                                                              • Collaborate Feature doesn't work

                                                                                                                Hello Team. It seems that the collaborate section is broken? I can post something but it all appears in "Discussions". In there is no way how I would mark something as Draft, Approval, post or any of the other filter categories? Also if I draft a post
                                                                                                              • IMAP Server not responding.

                                                                                                                Trying to connect a phone via IMAP and getting "imap.zoho.com not responding." Is the server down, for maintenance or otherwise? I've tried this on two different devices and got the same error on both.
                                                                                                              • Vendor Signatures Needed for Purchase Orders

                                                                                                                Hello everyone, We have a unique requirement that necessitates that Vendors & Suppliers formally acknowledge our Purchase Orders upon receipt. I was hoping that there would be an option to do so in Zoho Books, but that does not appear to be the case.
                                                                                                              • Share saved filters between others

                                                                                                                Hi, I am in charge to setup all zoho system in our company. I am preparing saved filters for everybody, but the only one can see its me. How can others see it? Thanks
                                                                                                              • report showing assignment type

                                                                                                                Hi, We've created a number of workflows to allow us to auto assign tickets to agents based on keywords and other criteria. I'm struggling to create a report that would show me what is the percentage of tickets that are assigned automatically via workflows
                                                                                                              • GST Slabs Redefined: Stay Compliant Using Zoho Books!

                                                                                                                Hello Everyone! The Government of India is rolling out new GST rates, a major reform aimed at simplifying the current tax structure starting 22 September 2025. GST will move from four slabs (5%, 12%, 18%, 28%) to two main slabs (5% and 18%), plus a special
                                                                                                              • Placing a condition before converting the LEAD

                                                                                                                Hi,  I need some assistance with Lead conversion. I need to place certain conditions before allowing the user to convert the lead.  For example: up until the certain status's doesn't equal "green" don't allow to convert lead.  I tried creating this using
                                                                                                              • Kanban view on Zoho CRM mobile app!

                                                                                                                What is Kanban? The name doesn't sound English, right? Yes, Kanban is a Japanese word which means 'Card you can see'. As per the meaning, Kanban in CRM is a type of list view in which the records will be displayed in cards and categorized under the given
                                                                                                              • Presenting ABM for Zoho CRM: Expand and retain your customers with precision

                                                                                                                Picture this scenario: You're a growing SaaS company ready to launch a powerful business suite, and are looking to gain traction and momentum. But as a business with a tight budget, you know acquiring new customers is slow, expensive, and often delivers
                                                                                                              • No practical examples of how survey data is analyzed

                                                                                                                There are no examples of analysis with analytics of zoho survey data. Only survey meta data is analyzed, such as number of completes, not actual analysis of responses, such as the % in each gender, cross-tabulations of survey responses. One strange characteristic of Zoho analytics is that does not seem aware of how Zoho Survey codes 'multiple response' questions. These are questions where more than one option can be selected from a list. Zoho Survey stores this data as text, separated by commas within
                                                                                                              • Zoho Creator as LMS and Membership Solution

                                                                                                                My client is interested in using Zoho One apps to deploy their membership academy offer. Zoho Creator was an option that came up in my research: Here are the components of the program/offer: 1. Membership portal - individual login credentials for each
                                                                                                              • Formula field with IF statement based on picklist field and string output to copy/paste in multi-line field via function

                                                                                                                Hello there, I am working on a formula field based on a 3-item picklist field (i.e. *empty value*, 'Progress payment', 'Letter of credit'). Depending on the picked item, the formula field shall give a specific multi-line string (say 'XXX' in case of 'Progress
                                                                                                              • Adding Chargebee as a Data Connector

                                                                                                                Is it possible to get Chargebee added as a Zoho Analytics data connector?
                                                                                                              • Zoho CRM - Custom Views for Portal Users

                                                                                                                I'm looking for an option to customise custom views for portal users in CRM. It would be great if "portal user" was a permission on custom views.
                                                                                                              • Webform & spam

                                                                                                                Hi, We set up 2 webform on our website, fowarding the content to Zoho CRM. Since it has been opened up, we are getting lot of spam message (for now about 20 a day). To lower the  amount of false new leads we added the captcha field and new enquieries are send to the Approval Leads list. However we still get some spam. Is there any "anti spam" mechanism built in Zoho CRM, or how is the best way to avoid these kind of spam ? Thanks
                                                                                                              • Elevate your CX delivery using CommandCenter 2.0: Simplified builder; seamless orchestration

                                                                                                                Most businesses want to create memorable customer experiences—but they often find it hard to keep them smooth, especially as they grow. To achieve a state of flow across their processes, teams often stitch together a series of automations using Workflow
                                                                                                              • Dropbox to Workdrive

                                                                                                                Namaste, Trust you all are doing well. Wanted to check how this can be done with Zoho flow. I typically receive dropbox links from my clients. Is there a way where I can provide the link to Zoho flow and it downloads the files from dropbox link to a work
                                                                                                              • Sendmail function / custom action?

                                                                                                                I've setup a function hoping to email various business departments the details of a record once all work in that record is complete so gone about setting up a custom action in such way that each record line on the report has a button to click. Question is how do I actually include data from that record in the email that is sent when the button is clicked? I had thought that since this were being sent per record the email would include the data which had been entered
                                                                                                              • Deals by Stages Funnel not showing in correct order

                                                                                                                Using the Stage-Probability Mapping for the Deals module we have created a steps our deals will pass through, RFQ, Closed/Lost, Declined/No-Go, Pricing, Submitted, Negotiations, Won. However when I view the Deal By Stages Funnel it does not show in the
                                                                                                              • Adding a developer for editing the client application with a single user license

                                                                                                                Hi, I want to know that I as a developer I developed one application and handed over to the customer who is using the application on a single user license. Now after6 months customer came back to me and needs some changes in the application. Can a customer
                                                                                                              • Turning off the new UI

                                                                                                                Tried the new 'enhanced' UI and actively dislike it. Anyone know how to revert back?
                                                                                                              • Message "...does not support more than 100 distinct values..." WHY????

                                                                                                                I get this message on one of my reports: Sorry, Zoho Reports currently does not support more than 100 distinct values in columns. 'Account Name * Sum(Amount),Count(Amount Tier)' contains more than 100 distinct values.  Possibly, you can apply filter to reduce the number of distinct values in 'Account Name' or drop the 'Account Name' field in Rows. I want to list all ACCOUNT NAMES (about 500) with SALES BY ACCOUNT.  What is blocking this?
                                                                                                              • Attention API Users: Upcoming Support for Renaming System Fields

                                                                                                                Hello all! We are excited to announce an upcoming enhancement in Zoho CRM: support for renaming system-defined fields! Current Behavior Currently, system-defined fields returned by the GET - Fields Metadata API have display_label and field_label properties
                                                                                                              • Confirmation prompt before a custom button action is triggered

                                                                                                                Have you ever created a custom button and just hoped that you/your users are prompted first to confirm the action? Well, Zoho knows this concept. For example, in blueprint, whenever we want to advance to the next state by clicking the transition, it is
                                                                                                              • Cost of good field

                                                                                                                Is there a way we can have cost of good sold as a field added to the back end of the invoicing procedure and available in reports?
                                                                                                              • How to create auto populate field based on custom module in Zoho CRM?

                                                                                                                Hello, i'm still new to Zoho CRM and work as administrator in my company. Currently, I'm configuring layout for Quotes Module. So, the idea is, I've created a read-only field in Quotes called "Spec". I want this field automatically filled with Specification
                                                                                                              • Rich Text For Notes in Zoho CRM

                                                                                                                Hello everyone, As you know, notes are essential for recording information and ensuring smooth communication across your records. With our latest update, you can now use Rich Text formatting to organize and structure your notes more efficiently. By using
                                                                                                              • Date triggering Workflow rule

                                                                                                                I have a function triggered by a workflow rule. The function takes a date and creates a task for that date and fills in a field with the name of the day for that date. It also updates the status field of the record. The workflow rule is set to run whenever
                                                                                                              • Change Last Name to not required in Leads

                                                                                                                I would like to upload 500 target companies as leads but I don't yet have contact people for them. Can you enable the option for me to turn this requirement off to need a Second Name? Moderation update (10-Jun-23): As we explore potential solutions for
                                                                                                              • Office 365 and CRM mail integration: permission required

                                                                                                                Has anyone run into this weird problem? My email server is Office 365. When I try to configure Zoho CRM to use this server, a Microsoft popup window opens requesting user and password. After entering that, I get a message in the Microsoft window saying
                                                                                                              • Time Entry Notifications

                                                                                                                Hi All - I have support staff who place notes of their work in the time entry section of Zoho Desk. Is there a specific workflow or setting I need to enable to have the ticket holder updated via email when an entry is saved?
                                                                                                              • Tables improvement ideas / features

                                                                                                                Heya, I've been using Zoho Tables for a few months now and wanted to post some features that I think will be greatly beneficial for the tool: 1. Ability to delete a record in automation or move a record in automation. - Usecase: I move a record from one
                                                                                                              • Deluge - Can't get phone number SalesIQ

                                                                                                                Hey folks, I’m building a custom plug for SalesIQ that’s supposed to register leads into Zoho CRM. The SalesIQ chat is being implemented on WhatsApp, and in my plug I’m using this line: mobile_clean = session.get("phone").get("value"); From what I understand,
                                                                                                              • Next Page