Queries - Frequently Asked Questions
1. What is the Queries feature in Zoho CRM?
The Queries feature in Zoho CRM allows you to retrieve data from CRM modules dynamically and third-party services directly within the platform. You can associate these queries with various CRM components such as Canvas, Kiosk, and other custom UI elements, enabling seamless data integration and enhanced user experience.
2. What are the components of a query in Zoho CRM?
A Query in Zoho CRM comprises the following components.
- Source: The data provider, which can be a CRM module, a COQL query, or a custom source like a REST API.
- Query: The configuration that defines how data is fetched from the source.
- Variables: Placeholders that allow for dynamic value assignment during query execution.
- Schema: The structure that defines the path, CRM field type, and label of each field in the query’s response.
- Serializer: A tool that enables manipulation of the query response using JavaScript to suit specific needs.
3. How can I create a custom source for a Query in Zoho CRM?
- Navigate to Setup > Developer Hub > Queries.
- Click on the Sources tab.
- Click Add Source.
- Provide the following information:
- Name: The name of the resource.
- Base URL: The URL of the third-party service or Zoho service from which data must be fetched. This URL must be listed in the Trusted Domain.
- Default Parameters and Headers: Any default parameters and headers required for the request.
- Under Connection, choose or create a connection for the data provider.
- Click Save to finalize the source creation.
4. How can I modify the schema of a query in Zoho CRM?
To modify the schema of a Query,
- Navigate to Setup > Developer Hub > Queries.
- Locate the desired query and hover over it.
- Click the three-dot icon and select Manage Schema.
- In the schema editor, you can
- Edit the Path: The JSON path where the field is located in the response.
- CRM Field Type: Specify the field type in CRM (integer, string, etc).
- Label: Update the label/name of the field as needed.
- Click Save to apply the changes.
5. What are query variables and how can I use them in Zoho CRM Queries?
In Zoho CRM Queries, variables act as placeholders that are dynamically replaced with actual values at runtime. They improve flexibility by enabling dynamic data retrieval and allowing reusability within the same query.
Defined using the syntax {{Variable_Name}}, they are particularly useful in COQL, REST API calls, and query criteria to filter and fetch data efficiently. When associating a query with components like Canvas, these variables should be mapped to the required fields to ensure proper data retrieval.

6. What is serialization in Zoho CRM Queries and why is it important?
Serialization in Zoho CRM Queries involves transforming complex data structures into a more meaningful format tailored to business needs. It allows for response customization by filtering and focusing on relevant fields, adjusting the schema to include only pertinent data, and enhancing user experience by presenting clear and concise information.
7. Can you provide a practical example of using query variables in Zoho CRM?
Consider a scenario where a salesperson needs to find nearby post offices based on a customer’s PIN code. By setting up a query with a variable representing the customer’s PIN code, the system can dynamically fetch and display a list of nearby post offices on the Contact record’s detail page. Read our Kaizen post on Handling Query Variables in Zoho CRM for step-by-step details on achieving this.
8. How do query variables differ from CRM variables?
While CRM variables store static, reusable information across the organization, query variables are designed to receive their values at runtime, enabling dynamic data retrieval in queries.
9. Under which scenarios are query variables useful?
Query variables are beneficial in scenarios such as,
- COQL: Dynamically filtering and retrieving data.
- REST API: Fetching data at runtime based on specific parameters.
- Query Criteria: Defining conditions dynamically for fetching records.
10. What is schema management in Zoho CRM Queries?
Schema management in Zoho CRM Queries involves defining and customizing the structure of the data retrieved by a query. It outlines each field’s path, CRM field type, and label, allowing you to modify the auto-generated schema to suit your requirements better. For instance, you can update field labels and types to present data in a more user-friendly manner.
11. How does serialization affect the schema in Zoho CRM Queries?
Serialization impacts the schema by adjusting it to include only relevant data in the serialized output. This is particularly useful when querying a module with multiple relationships, as it ensures that only necessary fields are included, making the data more concise and meaningful.
12. Can you provide an example of how serialization changes the schema?
Consider a scenario where a query retrieves a list of post offices for a given PIN code. Initially, the schema includes all fields returned by the query. Using serialization, you can refine the schema to display only specific fields, such as the name and delivery status of operational post offices, in the response, thereby making the data more relevant and easier to interpret.
13. Why is customizing the schema important in Zoho CRM Queries?
Customizing the schema is important because it allows you to present data in a way that aligns with your business needs. By updating field labels and types, you can make the data more intuitive and accessible, enhancing the overall user experience and ensuring that the information displayed is pertinent to your specific requirements.
14. Can I utilize a REST API-enabled function within Queries?
Absolutely! You can use a REST API-enabled function in Queries by leveraging the crmAPIResponse object. This ensures that the function response is structured correctly and compatible with Queries, enabling seamless data retrieval and integration with Zoho CRM. Refer to the Kaizen post Leveraging the 'crmAPIResponse' Object in Queries to learn how.
15. What types of query sources are available in Zoho CRM?
Zoho CRM offers the following three types of query sources.
- Modules: Retrieve data directly from CRM modules.
- COQL (CRM Object Query Language): Fetch data using COQL, similar to SQL’s SELECT statements.
- REST API: Access data from external services via REST API calls.
16. How can I associate a query with a Canvas in Zoho CRM?
To integrate a query into a Canvas in Zoho CRM, follow these steps.
1. Access Canvas Editor
- Navigate to the desired module’s detail view where you want to add the Canvas.
- Click the Canvas option to open the Canvas editor.
- REST API: Access data from external services via REST API calls.
2. Associate the Query
- In the Canvas editor, locate the Queries component on the left panel, represented by a database icon.
- Click Associate Query.
- Provide an Association Name for reference.
- Select the appropriate Source (e.g., CRM Module, COQL, or REST API).
- From the Query drop-down, choose the specific query you previously created.
- Choose the Display Type for how the data will appear on the Canvas.
- Provide an Association Name for reference.
3. Map Variables(if applicable)
- If your selected query contains variables, they will be listed under the Variables section.
- For each variable, select the corresponding CRM field from the drop down to ensure dynamic data retrieval.
4. Finalize and Design
- Click Done to confirm the association.
17. What is the role of queries in Zoho CRM’s Kiosk?
Queries in Zoho CRM’s Kiosk facilitate the retrieval and storage of data directly within CRM. It enables the system to fetch data from CRM modules, COQL, or external sources via APIs, enhancing customer engagement and streamlining data collection processes.
18. Where can queries be utilized within a Kiosk?
Queries can be employed in the following components of a Kiosk.
- Screen: Incorporate a query to retrieve data entered in previous screens or to display CRM data to users.
- Decision: Apply a query within a decision component’s criteria to determine the flow based on retrieved data from prior screens.
Note
Queries can be added to a decision component’s criteria only if the data is retrieved in a previous screen of the Kiosk.
19. How do I add a query to a Kiosk screen?
To add a query to a Kiosk screen,
- Click the ”+” icon to add an element.
- Select Screen and click Add.
- Choose Get data via Queries.
- Click New Query.
- Select an existing query or click Add Query to create a new one, and provide the necessary details, such as source, information, criteria, and serializer.
- Click Next.
- Edit the query name and choose the fields you want to retrieve.
- Specify record preferences(single or multiple records), and configure identifiers if you are fetching multiple records.
- Click Save to finalize the query addition to the screen.
20. How can I incorporate a query into a Kiosk decision component?
To add a query to a decision component,
- Click the ”+” icon to add an element.
- Select Decision and click Add conditions based on.
- Choose Queries from the drop down.
- Select the desired query, define the criteria, and click Done.
This setup allows Kiosk to make decisions based on data retrieved via queries in previous screens.
21. What are the return types of a schema in Zoho CRM Queries?
Schema in Zoho CRM Queries returns data in one of the following two formats.
- Map Type: Returns a structured key-value format, ideal for retrieving single records or specific fields.
- Table Type: Returns data in a tabular format, best suited for handling multiple records.
22. Why is the return type important in schema-based queries?
The return type determines how query results can be used across different CRM components. Choosing the appropriate return type ensures compatibility with the intended integration, such as Canvas, Kiosk, or custom UI elements.
23. How does the return type affect data association in CRM components?
- Map Type: Works well in places where a single field or a structured JSON response is needed. It can be directly used in Canvas components for displaying specific fields.
- Table Type: Used for multi-record data retrieval, such as in list views, reports, or dashboards. However, it cannot be used in places requiring a single field association, like individual field mappings in Canvas.
24. Where should I use Map and Table type return schema?
Use Map Type when you want to,
- Fetch data of a single record.
- Associate with fields in Canvas or workflows requiring a key-value structure.
Use Table Type when you want to retrieve multiple records for list-based views.
25. What happens if I use a Table type schema where only a single field is required?
If you try to use a Table Type schema in places where a single field is required (such as Canvas field associations), it may result in errors or unexpected behavior. Ensure that the query output matches the required format to avoid compatibility issues.
26. What is the difference between filtering by Record ID and using Record ID in the criteria?
- Filter by Record ID: Retrieves a single record directly from the selected module by specifying the Record ID as a filter.
- Using Record ID in the Criteria: Returns a list of records that match the given Record ID but technically provides a single record inside an array.
27. When should I use “Filter by Record ID”?
Use “Filter by Record ID” when you want to retrieve a specific record from a module directly without needing additional criteria. This is useful for fetching a single record efficiently.
28. When should I use “Record ID in the criteria”?
Use “Record ID in the criteria” when fetching related records. This approach is ideal when retrieving records that are linked to another module through a lookup field.
29. What is an example use case for using Record ID in the criteria?
If you need to fetch contacts associated with a specific deal, follow these steps.
- Create a query in the Contacts module
- Select the Deal lookup field as the related module.
- Set a variable for the Deal’s Record ID inside the criteria.
This will retrieve only the contacts linked to the specific deal, ensuring that the query dynamically fetches the correct related records.
30. Why does using Record ID in criteria return a list instead of a single record?
Even though a Record ID is unique, when used in criteria, it applies as a filter condition rather than a direct selection, returning an array of results (which often contains just one record). This behavior is designed to support cases where multiple records might match the condition, such as fetching related data.
31. What is the difference between dynamic and dtatic criteria in Zoho CRM Queries?
- Dynamic Criteria: Allow you to set field values dynamically using variables, making the query adaptable based on runtime input.
- Static Criteria: Use fixed values in the criteria, meaning the query will always return results based on pre-defined values.
32. When should I use dynamic Criteria?
- The query needs to filter results based on user input or external values.
- You are retrieving related records by passing Record IDs dynamically.
- The query is used in Kiosk or integrations where values change frequently.
33. When should I use static Criteria?
- The filter values do not change and are known in advance.
- You need a consistent data set every time the query runs.
- The query is used in Kiosk or integrations where values change frequently.
34. Can I mix dynamic and static criteria in the same query?
Yes! You can combine both dynamic and static criteria within the same query. For example, you can filter contacts by a specific country(static) while also filtering only those linked to a specific deal ID(dynamic).
35. What is an example use case of dynamic criteria?
If you want to fetch contacts associated with a deal, you can
- Set the module as Contacts.
- Use Deal Lookup Field as the related module.
- Set Deal ID as a dynamic variable in the criteria.
This ensures that the query dynamically fetches the contacts linked to the deal ID passed at runtime.
36. What is an example use case of static criteria?
If you want to fetch all contacts from a specific country, you can
- Select the Contacts module.
- Set the Country field as “USA”(static).