Retrieving a specific variable in Zoho CRM lets you pass dynamic, runtime values into queries and components — keeping your data fetches flexible without hardcoding criteria.
Why this matters
When you build queries in Zoho CRM's Developer Hub, you often need to filter or parameterise results based on context that changes at runtime — such as the current user, a selected record ID, or a date range. Variables solve this by acting as placeholders that get resolved when the query actually executes. Without them, you would need a separate query for every possible filter combination, which quickly becomes unmanageable. [6]
Step-by-step
Step 1. Navigate to the Queries section by going to Setup → Developer Hub → Queries. The Queries window will open, showing any existing queries you have configured. [6]
Step 2. Open the query in which you want to use a variable, or click to create a new one. Choose the appropriate source type — Module, COQL, or REST API — depending on where your data lives. Each source type determines how and where variables can be inserted. [6]
Step 3. Declare your variable directly inside the query definition. Variables must be written in double curly braces using the format {{VARIABLE_NAME}}. You can place them inside criteria filters, COQL statement conditions, field values, or REST API endpoint paths and headers — wherever a dynamic value is needed. [6]
Step 4. Save the query. Once saved, the variable placeholder is registered and ready to be mapped. [6]
Step 5. Associate the query with a component (for example, a Canvas element or a dashboard widget). During the association step, you will be prompted to map each declared variable to the relevant field or input source. This mapping is what tells Zoho CRM what real value to substitute into {{VARIABLE_NAME}} at execution time. [6]
Step 6. Test the query by triggering the component or running the query in context. The system will resolve each {{VARIABLE_NAME}} placeholder with the mapped runtime value and return filtered results accordingly. [6]
Extracting a variable value from a nested data structure
If your variable contains structured data — for example, a JSON payload arriving from an external integration like Calendly — you may need to parse a specific field out of it before mapping it to a CRM field. A common scenario is a phone number buried inside a nested object such as:
"questions_and_answers": {
"question": "Phone number",
"answer": "0612345678",
"position": 0
}
In this case, the raw variable cannot be mapped directly to a CRM phone field. You would need to extract the answer key from the payload first — typically using a transformation step in your integration flow (such as a Zoho Flow function or a custom function) — before passing the clean value into the CRM field. [2]
Common pitfalls
- Incorrect syntax: Variables that are not wrapped in double curly braces (
{{VARIABLE_NAME}}) will be treated as literal strings rather than dynamic placeholders, causing queries to return no results or throw errors. Always confirm the exact format. [6] - Unmapped variables at association time: If you declare a variable in a query but forget to map it when associating the query with a component, the runtime value will be empty and your query will likely return unexpected results. Double-check every variable has a corresponding mapping. [6]
- Nested JSON values: When a variable holds a complex object (like a Calendly webhook payload), you cannot map a nested property directly. You must first extract the specific value using a transformation or custom function before it can populate a CRM field cleanly. [2]
- Source type restrictions: Not all variable placements are available for every source type. For instance, REST API source queries allow variables in endpoint URLs and headers, while COQL queries use them inside the query statement itself. Confirm which placements are valid for your chosen source. [6]
What to check
- Verify that every
{{VARIABLE_NAME}}in your query is correctly mapped to a field or input source when the query is associated with a component. [6] - Confirm the variable value being passed at runtime is the correct data type expected by the target CRM field (e.g., a plain string for a phone number, not a JSON object). [2]
- After execution, review the query response to ensure the returned data matches the expected filtered result — not the full unfiltered dataset. [6]
---
*Beam Help is an independent expert support resource for Zoho products and is not official Zoho support. For platform-level issues, always verify with Zoho's own documentation.*