How to call Zoho CRM APIs using Client Script

How to call Zoho CRM APIs using Client Script



Welcome back to another exciting Client Script post!
In this post, we will discuss one of the most frequently asked questions: How do you call Zoho CRM APIs from Client Scripts?

In this kaizen post,


1. Ways to make calls to Zoho CRM APIs using Client Script
      1.A  Client Script ZDK CRM APIs
      1.B. Using Connections
2. Requirement
3. Solution
      3.A. Create a Connection
      3.B. Invoke API using Client Script
4. Summary
5. Related Links



1. Ways to make calls to Zoho CRM APIs using Client Script

1.A  Client Script ZDK CRM APIs 
  • You can use the available Client Script ZDK CRM APIs to call v2 APIs directly from within your Client Script. 
  • To view this documentation, click on the help icon next to CRM API in the Library Section of the Client Script Editor. Here is how the screenshot of the documentation looks.


1.B. Using Connections

For calling other Zoho CRM APIs(other than the APIS covered in Client Script's ZDK CRM API) or third-party services, you will have to use Connections along with Client Script. In this post, let us see how to call Zoho CRM APIs. Check the Kaizen post on Third Party Integration using Client Script to know how to call Third Party APIs from Client Script.

2. Requirement

To retrieve all open deals for the currently viewed account.

3. Solution

To fetch app open deals for an account, you can use  COQL API. You can also use the Related Records API, get deals of a given account ID, and then filter the open deals.
But COQL API is recommended due to the following reasons.
- There is no indexing delay.
- You can use comparators such as is null, is not null, between, in, not in, like, and not like in your search query.
- You can fetch data from other lookup modules if any. Click this Kaizen Post for more details.
To accomplish this requirement, create a connection with the scopes for the API you want to call and create a Client Script

3.A. Create a Connection
  • To setup Connection, follow the below steps.
  • In Zoho CRM, go to Setup → Developer Hub → Connections and click "Create Connection".

  1. Select Zoho OAuth in Default Services and click "Create and Connect".

  • Specify a name for the Connection and select the Scopes required for COQL API.
ZohoCRM.coql.READ (and) ZohoCRM.modules.READ
(or)
ZohoCRM.modules.{module_name}.{operation_type}

  • Click Create and Connect.


3.B. Invoke API using Client Script
  • Go to Setup → Developer Space →Client Script. Click +New Script.
  • Specify the details to create a script and click Next.

  • Enter the following script and Click Save.

  1. var acc=$Page.record_id;
  2. var parameters = {
  3. "select_query": `SELECT Stage,Account_Name.id from Deals where Stage not in ('Closed Lost','Closed Won','Closed - Lost to Competition') and Account_Name.id = ${acc}`
  4. };
  5. var response = ZDK.Apps.CRM.Connections.invoke("c", "https://www.zohoapis.com/crm/v6/coql", "POST", 2, parameters, {});
  6. log(JSON.stringify(response));
  • You can invoke COQL API using Connections in Client Script using invoke() method.


Click here to know more about the Connections.
Here ,
  • Connection name is test
  • url is https://www.zohoapis.com/crm/v7/coql
  • method is POST
  • param_type is 2
  • parameters is the query stored in parameters variable.
  • headers - there are no headers in this case.
Summary

In this post we have discussed the following.
1. How to call COQL API using Client Script 
2. Steps involved to include the scopes via Connection
3. Advantages of COQL API


    • Recent Topics

    • What takes from the inventory quantity

      There are several options SaleOrders, PurchaseOrders, Invoices... which ones disminish the Inventory quantity of the product? Does the change occurs online?
    • Simple Deluge Script

      Hi. I'm brand new to functions but I'm trying to create a script to convert a date field in Meetings to a written format. For example, instead of 02/05/2025 8:00AM, I'd like to convert it to Wednesday, February 5, 8:00 AM. My Date field is the API Name
    • Show or hide a field based on the value selected in another field?

      Can this be done in CRM? If not and can only happen in Creator is there a way to combine Creator and CRM without paying for 2 accounts? Thanks in advance for your response(s). Moderation Update: I'm locking this post since a solution has been provid
    • Default account for service invoice

      Hello, My client has some invoices for which he has entered a service description rather than using an item.  Is there a way to set the income account on this invoice, or can that only be done by using an item?
    • Extracting data from ZOHO through API

      How can I extract the invoice and bill reports from ZOHO through API? I have to create a dashboard in Power BI and we do use other software too for accounting, so to get all data from different software in single place I need the API.
    • Tip of the week #42- Filter out suspected spam emails before they reach your team's inboxes.

      Are unwanted emails cluttering your inboxes and exposing you to potential threats like phishing and malicious content? The antispam feature in Zoho TeamInbox gives you the perfect solution to keep your inbox organized and secure. By adding trusted email
    • Pivot Chart - Zoho Creator

      In Zoho Creator, I want to enable an edit option within the Pivot Chart itself. Additionally, I want to avoid showing duplicated values for certain columns. For example, I’ve created a month-wise sales report for each product type. The form contains fields
    • Questions about ZohoCRM's portal features

      thanks for the care from you every time. I have a question about ZohoCRM's portal feature. Products are displayed to the customers invited in the standard portal, but the products and prices to be displayed differ depending on the segment of the customer.
    • Contact details when no answer in Chat

      Hello, it would be great to have a feature that when no one is answering in the chat for lets say 60 seconds ... the user gets a meesage to enter his email and we can follow up later. Now we can have only prechat forms ... which can loose potential clients
    • Customer Display Name

      The Customer Display Name defaults to only the first name.  Is there a setting to make it default to display both the first and last name? Thanks, Bryan
    • Introducing LinkedIn Apply Connect for Zoho Recruit

      Attract up to 3x more qualified candidates and hire more efficiently with LinkedIn Apply Connect. Let candidates fill-in job applications without any redirections, gain deeper insights with applicant highlights within Zoho Recruit, and keep candidates
    • How do you apply field validation to a date field?

      We are using Sign for remote e-signature of liability waivers. The signer must enter a date of birth, and if they are a minor their legal guardian must sign for them. However we have had numerous problems with signers returning an invalid date of birth
    • Field Updated based off Call Status

      I'm trying to create a Field Update where: When Call Status is Completed Lead/Contact/Account Description field with the information in the "Outcome Of Outgoing Call" Description field. Once our sales team finishes their calls and they add a description
    • 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,
    • Integrating Zoho Creator's Calendar Report with Zoho Calendar as App Calendar

      Hi, it would be helpful if Zoho Creator's Calendar report is integrated into Zoho Calendar as an app calendar.
    • Average Costing / Weighted Average Costing

      Hello fellow maadirs. I understand Zoho Books uses FIFO method of dealing with inventory costing, but do you guys have any plans to introduce average costing? We indians need average costing. It's part of our culture. Please. I beg thee. Thanks.
    • How Good Is Mail Search?

      I am thinking of switching to Zoho hosted mail. I have approx. 1.3G of mail in many hundreds of folders organized hierarchically. It goes up to 7 layers deep. I have to often pull up messages from previous years. Would I be able to search the entire content by using Zoho search? Right now I use an IMAP account. My desktop client is Thunderbird, the server is MailXchange hosted by 1and1. The server allows a multi layer structure, but the search function is useless. Because of that I have to use TB
    • 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
    • Problem when condition with lookup field in Zoho Creator

      this is my code: if input.promotions1 != null { info input.promotions1; } And this my result: when i info input.promotion1 (which is a lookup field), it turn back nothing, so what type of this field is? normally i use the condition: if lookup_field ==
    • Multiple workflows based on stage?

      I am trying to have multiple things happen when I close a deal. First, I would like to send a thank you/coupon email to all deals that are closed. Second, I would like to create connected records in a separate pipeline for certain projects that qualify.
    • Integrate WordPress site as a Knowledge Base for Zoho Desk Suggested Articles

      Dear Zoho Desk Support Team, We'd like to propose a feature enhancement for the Suggested Articles system within Zoho Desk. This feature would allow seamless integration with a WordPress knowledge base, enabling relevant article suggestions for agents
    • Error 403 (forbidden) when using get ticket API on a ticket in a new department

      Hi We use get ticket API and it works well. We created a new department and when we try to use the same API on the tickets from this department, it fails with the error: b'{"errorCode":"FORBIDDEN","message":"You are not authorized to access this resource."}'
    • Custom Buttons

      Is there any way to create a "Custom Button" that would initiate a workflow, or call a custom function, preferably directly from a ticket? In Zoho CRM records can have custom links and buttons that make outside integrations relatively simple.
    • Is there a way to automatically add Secondary Contacts (CCs) when creating a new ticket for specific customers?

      Some of our customers want multiple contacts to receive all notifications from our support team. Is there a way to automatically add secondary contacts to a ticket when our support team opens a new ticket and associates it with an account? This would
    • Issues with GC Integration and Ticket Retrieval in Instant Messaging

      I am using Guided Conversations (GC) within Instant Messaging (IM) channels. When a user sends a message, a ticket is created in Desk, but GC cannot identify which ticket it corresponds to. To address this, I have implemented a workflow rule to rename
    • Set Mandatory Lookup Fields in Ticket Layout

      I added a custom module called 'Site' in the desk. I also added a lookup field 'Site' in the ticket layout. Now, I want the 'Site' field to be mandatory in the blueprint transition. How can I do that?
    • How to Initiate WhatsApp Message on SalesIQ?

      I've just activated a Business WhatsApp phone number through SalesIQ because of its touted omnichannel chat approach. Sounds exciting. I understand that when a customer sends me a WA message, I can reply to it on SalesIQ and keep the chat going, perfect.
    • Calculation of depreciation

      Can we add the feature of calculating the depreciation on assets as the year-end and mark a journal once done?
    • Launching CPQ for Zoho CRM! An in-built solution for bespoke quote management

      Hello everyone, We are thrilled to announce the public release of CPQ (Configure, Price, Quote) for Zoho CRM, which is a fundamental block in sales management. NOTE: CPQ was a public early access feature from March 2023 — January 2024. Since February
    • The current Account Name is amt-lubricatingoil.com, and I would like to change it.

      Hello, my current Account Name is a***********l.com, and I would like to change it to w*******x.com. Thank you!
    • Changing Default PDF Name

      Is it possible to change the default name of a PDF? As of right now, all of my quotes are named 'QT_$QuoteNumber' (i,e: 'QT_19803471298374) - would it be possible to change this to: '$CompanyName - $AccountName - $QuoteNumber' for instance?
    • Is the a way to show the actual Zoho Books Invoice in Zoho Crm Deal ?

      Im currently using the following code to create deals and tasks based off a new quote in zoho books, the problem is the quote is created under Accounts in CRM in the Zoho FInance Module, so when the deal is created it does state the amount of the quote
    • How to auto-update a task owner in a preset list of tasks on a new project?

      We have automation set up between the CRM and Projects that will automatically create a new project with a preset list of tasks when a sales order is created for specific products. Of the tasks that are automatically populated in these new projects, we
    • Zoho Analytics - CRM Sync Failure

      We have experienced consistent sync failures between our Zoho CRM and Analytics apps, but there aren't any details provided as to why this failure might be occuring. Please advise on troubleshooting steps so we can figure out how to restore the sync.
    • Matrix dropdown

      Is there a way to create a matrix question with dropdown answers but 1 row correlates to 1 column? So really I want to combine 4 dropdown questions into 1 matrix but each question has a single, and different, dropdown for answers.
    • Client Script | Update - Introducing Subform Events and Actions

      Are you making the most of your subforms in Zoho CRM? Do you wish you could automate subform interactions and enhance user experience effortlessly? What if you had Client APIs and events specifically designed for subforms? We are thrilled to introduce
    • "Reply to" email address issue

      On the New campaign page, you select or add a reply to email address.  It sends a verification email to that email address. But my recipient had a filter on and never go tthe email.  Now he removed the filter, but campaigns says verification email already was sent.
    • [Client Script] How to get selected related record Id

      Hi Zoho, I set an client script button in related record list. We would like to fetch the selected record id/field for further action. But I don't know how to get the selected id. If there is not possible to get related record info, then what does the
    • Now Indian Businesses can start accepting online payments with Zoho and Razorpay

      Hello Everyone, At Zoho, we have always ensured a hassle-free online payment experience for our customers. Today, with our integration with Razorpay, Zoho's customers from India can now offer a seamless checkout experience for one-time and recurring payments, with a host of payment options including card payments, multiple wallet offerings, and net banking with over 50 banks. With Zoho and Razorpay, help your customers pay their way. Whether it's with debit cards, credit cards, wallets, or net banking,
    • Workflows being applied and the Large unwanted popup

      When a workflow is being applied do to an action, then the Agent is left with a large Window asking if they would like the see the changes this workflow did. Is there any way to disable this prompt from appearing?
    • Next Page