Hello all!!
Welcome back to another post in the Kaizen series!
Query API lets you query for records based on queries using the CRM Object Query Language(COQL). COQL is based on the SQL query syntax, and supports the SELECT query to fetch records. Using this API, you can query for data across different modules that are linked using lookup fields.
1. Why did I get a SYNTAX error for the following query?
{ "select_query":"select External from Contacts where id is not null" }
|
Answer:
The error occurs because the query uses an SQL reserved keyword, "External", as a column name without enclosing it in quotes. When using SQL reserved keywords like "External", you must enclose them in single or double quotes.
The above-query can be written as:
{ "select_query":"select 'External' from Contacts where id is not null" }
|
------------------------------------------------------------------------------------------------------------------------------------
2. Why does the following query throw an error?
{ "select_query":"select id from Contacts where id is not null and Account_Name is not null and Vendor_Name is not null" }
|
Answer:
When the query involves more than two criteria, ensure that you enclose your criteria properly by grouping them in pairs, such as ((A and B) and C).
The above-query can be written as:
{ "select_query": "select id from Contacts where ((id is not null and Account_Name is not null) and Vendor_Name is not null)" }
|
------------------------------------------------------------------------------------------------------------------------------------
3. How to escape single quotes within single quotes and double quotes within double quotes?
Answer:
For single quote:
If you want to retrieve a value that contains a single quote, for example, 1' 2 in the Designation field (a single-line field), you need to escape the single quote in the value by adding another single quote.
Example:
1'' 2
Sample Input and Response:
For double quotes:
If you want to retrieve a value which contains double quotes, for example, 1' ' 2 in the Designation field (any single-line field), then you have to escape each double quotes with backslash (\) in the value.
------------------------------------------------------------------------------------------------------------------------------------
4. Why does the following query throw an error?
{ "select_query":"select What_Id->Leads.Last_Name from Tasks where id is not null" }
|
Answer:
Special characters such as "-", ">" "*", and "!" in a query must be enclosed within quotes, either in single or double quotes.
Your query can be written as:
{ "select_query":"select 'What_Id->Leads.Last_Name' from Tasks where id is not null" }
|
------------------------------------------------------------------------------------------------------------------------------------
5. How can I retrieve records from a subform module using COQL?
Answer:
------------------------------------------------------------------------------------------------------------------------------------
6. How to retrieve Multi Select lookup field data using COQL?
Answer:
------------------------------------------------------------------------------------------------------------------------------------
7. Can I query more than 50,000 records?
Answer:
Up to V6, you can retrieve up to 10,000 records without changing the criteria by using the LIMIT and OFFSET in your query. When retrieving the initial 10,000 records, make an API call with Created_Time, Modified_Time, or ID in the ORDER BY clause. To fetch more than 10,000 records, apply a condition based on the fields used in the initial ORDER BY clause in the query.
From V7 onwards, we support retrieving up to
1,00,000 records without changing the criteria by using LIMIT and OFFSET in your query. To fetch more than 1,00,000 records, please refer to the
Pagination section for more details.
------------------------------------------------------------------------------------------------------------------------------------
8. Is territory field supported in COQL?
Answer:
Yes, you can use the territory field in the COQL from V7. Refer to the
Territories section in COQL document for sample.
------------------------------------------------------------------------------------------------------------------------------------
9. Is CVID support provided in COQL?
Answer:
Yes, from V7, you can use the CVID in your query. Refer to the
CVID section in the COQL document for details.
------------------------------------------------------------------------------------------------------------------------------------
10. What are the supported aggregate functions, and why do they not work with values like Avg or avg?
Answer:
The aggregate functions are case-sensitive and only work when specified in all capital letters. Using values like Avg or avg will result in an error.
The supported aggregate functions are MIN, MAX, AVG, SUM, and COUNT.
------------------------------------------------------------------------------------------------------------------------------------
11. Are other SQL-related functions like CONCAT or DATE() supported in COQL?
Answer:
No, COQL in Zoho CRM API Version 7 currently supports only aggregate functions and does not include other SQL-related functions like CONCAT or DATE().
------------------------------------------------------------------------------------------------------------------------------------
12. Is it possible to select more than 50 fields in the SELECT column?
Answer:
------------------------------------------------------------------------------------------------------------------------------------
13. Can Multi-Module Lookup inner fields be queried?
Answer:
Yes, you can query fields from the associated module in a Multi-Module Lookup (e.g., Appointments module).
Use the following format:
select 'What_Id->{associated_module_API_name}.{field_API_name_from_associated_module}'
Example:
{ "select_query": "select 'What_Id->Leads.Last_Name','What_Id->Accounts.Account_Type' from Events where id is not null" }
|
Note:
------------------------------------------------------------------------------------------------------------------------------------
14. Is Display Name available for all types of lookup fields?
Answer:
From V7, the display name is available for Lookup and User Lookup fields when you specify them in the SELECT column, but it is not available for Consent Lookup and Multi-Module Lookup (MML) fields.
Please note, for the Users module, only the "last_name" is shown as the display field for the Users module is last_name.
Example:
{ "select_query": "select Account_Name, Owner, Data_Processing_Basis_Details from Contacts where Data_Processing_Basis_Details is not null" }
|
Response:
{ "data": [ { "Owner": { //user lookup field "name": "Boyle", "id": "5725767000000411001" }, "Account_Name": { //lookup field "name": "Zoho", "id": "5725767000003464060" }, "Data_Processing_Basis_Details": { //consent lookup field "id": "5725767000005083039" }, "id": "5725767000005091053" } ], "info": { "count": 1, "more_records": false } }
|
------------------------------------------------------------------------------------------------------------------------------------
15. Is it possible to get a Full Name based on User Preference?
Answer:
The Full Name field is supported in the Leads, Contacts, and Users modules.
Leads and Contacts modules:
- Below V7: You must query the first_name and last_name fields separately and concatenate them to form the Full Name.
- From V7: You can directly query the full_name field in the SELECT column, and it will return data based on the User Preference.
Users module:
In all versions, the full_name field is not directly supported. You need to query the first_name and last_name fields separately and concatenate them to construct the Full Name.
------------------------------------------------------------------------------------------------------------------------------------
16. Is it possible to use Profile Image and Rollup Summary fields in criteria?
Answer:
------------------------------------------------------------------------------------------------------------------------------------
17. Which fields are restricted in all clauses?
Answer:
The following fields are restricted from being included in all columns:
- Multi-select lookup fields: These cannot be queried directly from the parent module. Instead, query them from their respective linking modules.
- Line items: Pricing_Details and Product_Details
- Pricing_Details: This field cannot be queried as it is not a subform but a separate section.
- Product_Details: This is a subform. You cannot query data from the parent module. Instead, query it directly from the respective subform module.
- Participants in the Events module.
- File/Image upload fields
- Availability Information fields in the Services module
- Choose Date(s)
- Choose Day(s)
Check the following image for reference.
------------------------------------------------------------------------------------------------------------------------------------
18. Which fields are restricted only in criteria?
Answer:
The following fields have restrictions when used in criteria:
- Multiline fields: Cannot be used in criteria.
- Encrypted numeric fields: Support limited comparators (is null, is not null, =, != ).
- Encrypted non-numeric fields: Support only is null and is not null comparators.
------------------------------------------------------------------------------------------------------------------------------------
19. Which fields are restricted only in the Group By clause?
Answer:
Encrypted fields are restricted from being used in the Group By clause.
------------------------------------------------------------------------------------------------------------------------------------
20. Which fields are restricted only in the ORDER BY clause?
Answer:
Encrypted fields are restricted from being used in the ORDER BY clause.
------------------------------------------------------------------------------------------------------------------------------------
21. Is External ID supported in COQL?
Answer:
Yes,
External ID has been supported from
Zoho CRM API's Version 4. Please note that operators such as
"is null" and
"is not null" are not supported in the criteria when using
External ID.
Supported operators are "=", "!=", "in" and "not in".
------------------------------------------------------------------------------------------------------------------------------------
22. How to resolve a 408 error (Request Timeout)?
Answer:
If your query takes more than a second to parse, a request timeout error will occur.
To avoid this, ensure the query is not overly complex and that all parentheses are properly balanced. Simplifying the query or fixing any mismatched parentheses can help resolve the issue.
------------------------------------------------------------------------------------------------------------------------------------
23. Is it necessary to query the records based only on the User Time Zone?
Answer:
No, users can query records based on any time zone. However, the response will always be returned in the time zone of the user who made the query.
------------------------------------------------------------------------------------------------------------------------------------
24. Which fields are restricted when using aggregate functions, for example, SUM(field_API_name)?
Answer:
Encrypted fields are restricted and cannot be used in the aggregate functions like SUM, AVG, MIX, or MAX.
------------------------------------------------------------------------------------------------------------------------------------
25. Where can we use Alias?
Answer:
Alias can be used in the SELECT clause and in the ORDER BY clause. You can assign an alias in the SELECT clause, and the assigned alias can be referenced in the ORDER BY clause. But you cannot assign an alias directly in the ORDER BY clause.
Note: Alias cannot be used in the other clauses, such as WHERE and GROUP BY.
------------------------------------------------------------------------------------------------------------------------------------
We trust that this post meets your needs and is helpful.
Stay tuned for more insights in our upcoming Kaizen posts!
Other FAQs in Kaizen
Cheers!!!
✨Happy 2025 ✨
Recent Topics
Zoho CRM Widget not displaying 2 related lists (JS)
Okay so I basically have 2 relatedLists that I want to get and render: ZOHO.CRM.API.getRelatedRecords({ Entity: data.Entity, RecordID: data.EntityId, RelatedList: "Notes", page: 1, per_page: 200, }) ZOHO.CRM.API.getRelatedRecords({ Entity: data.Entity,
KPI widget with percentage
I'm trying to create a KPM widget that displays current performance as a percentage - something like the picture below. I've tried following the instructions at https://www.zoho.com/analytics/help/dashboard/kpi-widgets.html#chart but nothing ends up being
Canvas List View Not Saving
Hi, I am trying to edit a list view to look different depending on the tags. Everything worked well and saved well with multiple views, but when I have gone back in to make some small changes like moving one of the icons it comes up with the error message
QR code image is not exported in PDFs
The new QR code field works fine when I include it in a report template and I choose the print option: https://creatorapp.zoho.com/<username>/<app_link_name>/record-print/<report_link_name>/<record_ID>/ But when I try to save the document to a .pdf file
QR codes in templates
I'm excited about the new QR code generator. I have included a QR code that contains the record ID setting "${ID}" as input data. In the report detail it works perfectly but when printing it in a template the code is not shown.
This mobile number has been marked spam. Please contact support.
Hi Support, Can you tell me why number was marked as spam. I have having difficult to add my number as you keep requesting i must use it. My number is +63....163 Or is Zoho company excluding Philippines from their services?
Zoho CRM search not working
The search bar is not showing any results in our CRM installation. We have a lot of items and can not search them by using the navigation each time. Can someone please check this asap.
Reload page with widget
Hi all, I hope I can find some help here. I developed a small widget for Creator that is integrated into a page as a component. The page contains other content as well. When the widget is sent, the entire page should be reloaded to apply the changes to
Tip of the week #37 - Manage all your Telegram business conversations directly from your shared inboxes.
Tired of switching between multiple apps to manage your business conversations? With Zoho TeamInbox's multichannel inboxes, connect your Telegram channel to a shared inbox. This way, your teams can easily handle c View, reply, and collaborate on them
Tags on notes aren't syncing correctly on Android
I've created notes on the desktop version that have several tags assigned, but on both my Android devices those notes only have ONE of those tags instead of all of them, despite the actual content of the note being correctly synced, and I'm also starting
Reports - custom layout - duplicate report
Do you also have this problem and what is the possible solution? I duplicate a report that has a "custom layout". Unfortunately the custom layout is not duplicated. To be improved for a future release by Zoho. I export the custom layout and import it...
How to map a global picklist from one module to another
Hi there, i currently have a new field that is called sales office which we use for permission settings between our different offices located in different countries. It is a global set picklist with three different options: MY, SG and VN. I want to be
Pageless mode needed to modernise Writer
When we switched from GSuite to Zoho, one of the easiest apps I found to give up, was Docs. In many ways, Writer has always been more powerful than Docs, especially in terms of workflows/fillable forms/etc. However, I went back into Docs because I notice
Changing the Logo Size on Zoho Sites
My company logo incorporates both an image and text, and I would like it to be much more prominent on the page than is currently allowed by the small logo box in the template. Is there any way to hide the page name and then make the logo box much bigger since my company name and logo are connected / are all in one file? Thank you.
Is it possible to Select Item Serial Numbers from a Sales Order?
Our accepted estimates are converted to Sales orders for our warehouse staff to pick. How can my warehouse staff select the serial numbers for an item when editing a Sales Order? Logically when staff pull an item and have the serial in front of them they update the Sales Order and select the serial. I understand a serial can be added when creating an invoice but how can accounts team know the serial if the warehouse staff can't select it! A basic flaw!
MORE BUGS: Client Script, Deluge and Widget JS SDK don't work as expected when trying to retrieve a record that has been "rejected" as part of an approval process.
Client Script $Page.record is null when accessing a record that has been "rejected" as part of an approval process. Deluge zoho.crm.getRecordById(moduleName, recordId) returns {"status":"failure"} when recordId is a valid, but rejected record. OK... I
Zoho CRM Widget not displaying 2 related lists (JS)
Okay so I basically have 2 relatedLists that I want to get and render: ZOHO.CRM.API.getRelatedRecords({ Entity: data.Entity, RecordID: data.EntityId, RelatedList: "Notes", page: 1, per_page: 200, }) ZOHO.CRM.API.getRelatedRecords({ Entity: data.Entity,
Zoho Books and Zoho Projects Task Status Update
How can we create an automation using custom functions for the following scenario. When our zoho books invoice status changes to paid. I want a task in Zoho projects to change to completed.
Default Sort Order in Project Tasks View
It should be possible to specify a default sort order (or have the last explicit sort order restored upon reload) for the tasks in the project tasks view. Currently the sort order must be manually re-selected for each sub-group whenever any changes are
Different content per social media account..
Is there a way to add different content per social media account on one post?
Assigning Tasks and Requests to Groups... how do I?
Guys, I've spent many hours exploring Zoho Support and we are generally satisfied with the system. I'm trying to understand how a system that has so much to offer can be missing GROUP assignment and queue functionality. I am hoping that there is a way
Parsing of SQL query failed. Please check the SQL syntax.
I am trying to have Zoho Analytics recognize that if the a Deal is in Stage "Need Docs" it should also be counted as a Deal in the Stage "New Lead" /*New Lead*/ SELECT "ID" 'New Lead' AS "Stage" From "Deals" Where "Stage" = 'Need Docs' Union All Error
Where is the setting to enable/disable 2FA?
The following links show where enable/disable 2FA is supposed to appear, but neither appear for me: https://help.zoho.com/portal/en/kb/zohosites/faq/account/articles/how-do-i-enable-or-disable-two-factor-authentication-for-my-account shows Security >
How to Assign Record Ownership in a Custom Form via API?
Hello everyone, I’ve created a custom form in Zoho People and I’m using the API to manage its records. I would like to know how I can assign ownership of these records to specific users via the API. Is there a specific parameter or field in the API request
Customer Statement Template not matching when sending
Hi everyone! So when I send statements to our customers via Zoho Books, the message that appears by default does not match what I have written on the template Under settings -> email notifications -> sales -> customer statement We have a single default
Working with keywords
Hello everyone, first time here so I will try to be brief. I am working on my company's data set. I have a table with all the images we have on line. For each image we hava a cell tha contains all keywords related to that image. I would like to explore
Peppol Malaysia API
Hi Zoho Books, my country Malaysia will going to implement "Peppol" (E-Invoicing), starting 1 Jul 2025 for all businesses. The government intends to provide API for accounting app. The workflow involves creating an invoice from accounting app, triggers
Re-emitir facturas con nueva dirección de facturación
Hola, necesito saber si es posible que las facturas ya emitidas, pueden ser re-emitidas con el cambio de dirección de facturación, realizado el día de hoy 02-01-2025, para efectos contables. Espero su ayuda, Gracias
Zoho Learn vs. Trainer Central
Hi, I'm currently using Zoho One with a WordPress-based website and WooCommerce to manage my online courses. I would like to know what is the difference between Zoho Learn and Trainer Central and if it's possible for these two platforms to replace WP
Map Plan to Different Income Account for Some Subscriptions via API
We have a plan that has a default Plan Account of "Sales". Can we override the account for a specific subscription via API? In some instances the same exact plan should map to a different income account. When we create stand-alone invoices in Zoho Books,
Flow with CRM
Hello, I have a simple flow that uses a web hook to enter data into a Sales Order. I have the web hook sending Flow data which has a PO field. If the PO has a special character like - or / or \ the task fails. How can I get the flow to be okay with the
We've revised the pricing model of CRM portal user licenses
Hello everyone, We’re making important updates to our pricing structure for portal user licenses, effective from the next payment cycle. The new slab-based pricing is as follows: Previously, these portal user licenses were priced at $5/ user/ month. As
Chrome browser issues. Anyone else?
I am suddenly having multiple issues with Chrome browser interpreting the Zoho Mail interface. Anyone else? Any known problems? Thanks, Todd
Set another Layout as Standard
We created a few layouts and we want to set another one to standard:
Zoho Payroll US?
Good morning, just reaching out today to see if there's any timeline, or if there's progress being made to bring Zoho Payroll out to be available to all states within the USA. Currently we're going through testing with zoho, and are having issues when
Set up multiple IMAP email addresses
Hi, I just started using CRM and its great, but I just found out I can only add one imap email address for incoming mail in the included salesinbox ...this is ridiculous. All companies have different email such as sales@domain, info@domain , personal@domain
Function 58: Custom calculation in item table of invoices (2 fields)
Hello everyone, and welcome back to our series! In Zoho Books, the Item Amount in invoices is calculated by multiplying the Quantity and Rate fields. Previously, we shared a function to include a custom field in this calculation. Today, we are taking
Tracking new lead response time
Hi, I have a team of Sales Development Reps, who have a KPI of responding to a lead within 20 mins or less once it hits the system. I seem to recall that Zoho CRM had the capability to track this in a previous version, but don't see it anywhere. It's
Pushing Data from One CRM account to another.
We have business partners that want to collaborate through the CRM. Other than pre-planned data migrations what are the options for Zoho Users to transfer data between the accounts. For instance, could I create a webhook that is sent from our CRM and then is picked up in the partner's Flow?
Search function not working anymore
Hi! The search function is not working anymore. How can we solve this problem?
Next Page