Kaizen#135 : Third Party Integration using Client Script

Kaizen#135 : Third Party Integration using Client Script

Hello everyone !

Welcome back to another enlightening Kaizen post! In this Kaizen post, we'll explore how to invoke a Third-Party API through Client Script. This enables you to seamlessly connect to external services and fetch dynamic data. Stay tuned to discover the step-by-step process of invoking a Third-Party API withi your client-side scripts. This post will answer the question on Importing data from third party API.


In this Kaizen post,

  1. Overview
  2. What are Connections?
  3. How to invoke a Connection in Client Script?
  4. Use Case 
  5. Solution 
    1. Create a Connection.
    2. Add to Trusted Domain.
    3. Invoke the connection in Client Script and populate the field using Client Script.
  6. Summary
  7. Recommended Reads


1. Overview



To accomplish Third Party Integration using Client Script,  you need to create a Custom service Connection and invoke the connection in Client Script. Once you get the response from the Third Party API call, you can populate or display the required data using Client Script. 


2. What are Connections?

Connections in Zoho CRM  is used to establish authentication with other Zoho or third-party services to perform integration with them. Check this Kaizen post to know more about Connections and Authentication types.

3. How to invoke a Connection in Client Script?

To invoke a Connection using Client Script, you need to use the invoke method with the required parameters.

Syntax :                  invoke(connection_name, url, method, param_type, parameters, headers)  




Note: 

           Whenever you want to make third party API calls, you need to whitelist them by adding the third party domain to Trusted Domain.                     


4. Use Case :

Zylker is a manufacturing organisation. Orders will be placed by the Salesperson by creating a record in the custom module "Requests" . The Admin wants to populate the distance between Manufacturer Location and Seller Location in the "distance" field using the Distance Matrix API.



5. Solution :
To populate the field "Distance" based on the response recevied from the third party API call using Client Script you need to follow the below steps.
  1. Create a Connection.
  2. Add to Trusted Domain.
  3. Invoke the connection in Client Script and populate the field using Client Script.

1. Create a Connection :

  • In Zoho CRM, go to Setup → Developer Hub → Connections and click "Create Connection"


  • Under "1. Pick Your Service" , select "Custom Services" and click "Create New Service".


  • Enter the following details and click "Create Service".



  • Now,  you will be prompted to enter the authentication credentials, Here it is the API Key. Enter the value and click "Connect".



2. Add to Trusted Domain:
  • Whenever you want to make third party API calls, you need to whitelist them by adding the third party domain to Trusted Domain.

  • To do this go to Setup → Security Control → Trusted Domain.


  • Click New Trusted Domain.


  • Enter the Name and Domain details and click Save.
3. Invoke the connection in Client Script and populate the field using Client Script.

  • The next step is to invoke the connection using Client Script using the invoke method.
  • For this, create a Client Script on Create Page of "Requests" custom module and specify the event as onChange Page event as follows and click Next.
     


  • Enter the below script and click Save.

Script :

  1. if (field_name == "Seller_Location" || field_name == "Manufacturer_Location") {
  2.     let origins = ZDK.Page.getField('Manufacturer_Location').getValue();
  3.     let destinations = ZDK.Page.getField('Seller_Location').getValue();
  4.     let dist = ZDK.Page.getField('Distance');
  5.     dist.setReadOnly(true);
  6.     var response = ZDK.Apps.CRM.Connections.invoke("measuredistance", `https://api.distancematrix.ai/maps/api/distancematrix/json?`, "GET", 1, { "origins": origins, "destinations": destinations }, {});
  7.     let distance = response._details.statusMessage.rows[0].elements[0].distance.text;
  8.     dist.setValue(distance);
  9. }
  • Here the values of the fields Seller_Location and Manufacturer_Location are captured using getValue() and are stored in origins and destinations respectively. The Third Party API - Distance Matrix returns the distance between origins and detstinations. So you need to pass these two parameters in the invoke() method and  capture the response and populate the distance to the "Distance" field using setValue() method.
  • As per the following syntax, you should pass the required parameters.
Syntax : invoke(connection_name, url, method, param_type, parameters, headers) 

  • The connection_name  is "distanceMatrix".
  • The URL is https://api.distancematrix.ai/maps/api/distancematrix/json?&key=${key}Note that the "key" is represented as ${key} as it is a variable. This is the variable name that you mentioned while creating the Connection.
  • GET is the method as we are fetching data.
  • For URL parameters , you should mention 1.
  • Parameters are { "origins": origins, "destinations": destinations } 
  • {} represents that there are no headers.
  • Now, create a record in Requests and enter the location details. You can see the "Distance" field getting populated as shown below.

  • Here is how the Client Script works.


6. Summary :

In this post we have discussed,
  • How to invoke a third-party API call in Client Script
  • How to create a Custom Service Connection
  • How to use Connections in Client Script.
  • How to add a new Trusted Domain
  • How to populate a field with the response of a third-party API call.

7. Recommended Reads :
______________________________________________________________________________________________________________________________________

Previous post :  Kaizen #134 : Manipulating Rich Text Field (RTF) using Zoho CRM APIs | Kaizen Collection : Home.                     

Join us for our upcoming Zoho CRM Developer Series: Zoho CRM APIs, where you can explore more about Zoho CRM APIs. Register Now!  
  



Cheers!
Maadhari M






    Access your files securely from anywhere

        All-in-one knowledge management and training platform for your employees and customers.






                              Zoho Developer Community




                                                    • Desk Community Learning Series


                                                    • Digest


                                                    • Functions


                                                    • Meetups


                                                    • Kbase


                                                    • Resources


                                                    • Glossary


                                                    • Desk Marketplace


                                                    • MVP Corner


                                                    • Word of the Day


                                                    • Ask the Experts



                                                              • Sticky Posts

                                                              • 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.
                                                              • Kaizen #226: Using ZRC in Client Script

                                                                Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
                                                              • Kaizen #222 - Client Script Support for Notes Related List

                                                                Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how
                                                              • Kaizen #217 - Actions APIs : Tasks

                                                                Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
                                                              • Kaizen #216 - Actions APIs : Email Notifications

                                                                Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are


                                                              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

                                                                                                Get Started. Write Away!

                                                                                                Writer is a powerful online word processor, designed for collaborative work.

                                                                                                  Zoho CRM コンテンツ



                                                                                                    Nederlandse Hulpbronnen


                                                                                                        ご検討中の方




                                                                                                                • Recent Topics

                                                                                                                • Deluge Learning Series – Mastering file handling in Deluge | April 2026

                                                                                                                  The Deluge Learning Series is conducted on the fourth thursday of every month. In each session, we discuss built-in functions and statements in Deluge and demonstrate how they are used across different Zoho products. With practical examples and real-world
                                                                                                                • Multi-currency and Products

                                                                                                                  One of the main reasons I have gone down the Zoho route is because I need multi-currency support. However, I find that products can only be priced in the home currency, We sell to the US and UK. However, we maintain different price lists for each. There
                                                                                                                • Editing recurring tasks

                                                                                                                  Hi there, I use recurring annual tasks quite often but sometimes I have a contact leave an organization so I want to re-assign that annual task to a new contact. When I go into the task to change the contact it only does so for the current year. Future
                                                                                                                • Cross Module Filtering – Use Fields from Lookup modules in Custom Views criteria and Advanced Filters

                                                                                                                  Hello everyone, Zoho CRM now enables you to achieve deeper filtering of records in a module, using fields of a lookup, thereby enhancing your data management experience manifold. This filtering based on lookup module fields is now available in advanced
                                                                                                                • On Duty Requests - Zoho People Data

                                                                                                                  Hello Team, We are currently using the On Duty Form to record Work From Home (WFH) requests in our organization. However, we are facing an issue where pending On Duty requests are not appearing in the Attendance Module. For example, if I submit On Duty
                                                                                                                • Business Day Logic Update: More Accurate Scheduling for Your Workflows

                                                                                                                  Hello everyone, We’re improving how business-day calculations work in workflows, especially when triggers happen on weekends. This update ensures that offsets like +0, +1, and +2 business days behave exactly as intended, giving you clearer and more predictable
                                                                                                                • Styling for Subform Fields using client script

                                                                                                                  Currently we can add styles to list and detail page for fields using .addstyle in the Client Script But that is missing for fields of Subform We would really like the feature to addstyle for subforms in the detail page Can you please consider adding it,
                                                                                                                • Zoho Commerce -

                                                                                                                  Zoho Commerce currently only allows merchants to define the United Kingdom as a single shipping zone, which creates a significant issue for businesses operating between the EU and the UK. Under the Northern Ireland Protocol, Northern Ireland follows EU
                                                                                                                • Add a way to connect Log360 Cloud logs with Zoho analytics

                                                                                                                  Hi, Several month ago Log360 Cloud was added to zoho one - and this is great. But as far as I see there is no prebuilt way to connect Zoho analytics to the logs we have in Log360 Cloud. Please add a prebuilt connection like we have for so many other zoho
                                                                                                                • IP flagged as abusive

                                                                                                                  I'm getting the error that 136.143.188.15 is listed as abusive. I've checked with mxtoolbox.com and it is indeed in the list
                                                                                                                • date & datetime client script getInput types

                                                                                                                  Please add date & datetime as available types for the getInput client script function. https://www.zohocrm.dev/explore/client-script/clientapi/Client#getInput
                                                                                                                • Approval Workflow Not Triggering When Status Updated via Custom Button

                                                                                                                  Hi Team, I’m facing an issue with an approval workflow in my application. I have a workflow that updates a record’s Status field from “Pending” to “Waiting for Approval.” I have configured an Approval Workflow with the condition: Status = "Waiting for
                                                                                                                • Data Import

                                                                                                                  Hello Latha, Is there any option to enable data import option in Equipment module? Best regards, Chethiya.
                                                                                                                • Unable to Access /crm/v7/taxes – OAuth Scope Mismatch in Zoho CRM API

                                                                                                                  I am currently integrating Zoho CRM (v7 API) with our system and I need clarification regarding the Taxes API and OAuth scopes. Context: We are creating Quotes via the API (/crm/v7/Quotes) Each quote contains line items with taxes (e.g., TVA 19%, 10%,
                                                                                                                • Email from CRM being Blocked or Marked as Spam by Google (and maybe more)

                                                                                                                  In the past 24 hours we’ve noticed that emails sent via Zoho CRM are being blocked or flagged as phishing, particularly by Google. The issue seems to occur specifically when emails contain links. URLs like www.domain.com or www.example.com are automatically
                                                                                                                • Marketing Tip #29: Make it easier to shop by grouping products into collections

                                                                                                                  A well-organized store helps customers find what they want faster, which directly improves conversions. When products are grouped into clear categories or collections, shoppers don’t have to scroll endlessly or search manually. It also makes your store
                                                                                                                • 【無料/オンライン】4/30開催|Zoho ワークアウト(オンライン勉強会)

                                                                                                                  ユーザーの皆さま、こんにちは。 コミュニティグループの中野です。 4月開催の「Zoho ワークアウト」のご案内です。 本イベントは、Zohoユーザー同士で交流しながら 設定・運用・活用に関する課題解決を目指すオンライン勉強会です。 「設定を進めたいけれど、一人だと手が止まってしまう」 「他社がどう活用しているのか知りたい」 「相談できる相手がおらず、運用に悩んでいる」 そんな方におすすめのイベントです。 ▶︎参加登録はこちら(無料) https://us02web.zoom.us/meeting/register/qIH1ut8aTnq-R7-21eF3BQ
                                                                                                                • Zoho Desk - Support Plan by Time Log Hours

                                                                                                                  Hi Desk Team, When creating a Support Plan, it would be great to have an option under Plan Type for Time Based Plan. This would be based on the number of work logs created for a customer account. It's very common to offer a support contract which has
                                                                                                                • Help Center and SEO: Any Benefit to My Domain-Mapped Website Ranking?

                                                                                                                  First of, I love the Help Center which I've just decided to integrate into my website to replace its old-fashioned FAQs. So much more to achieve there now! Lots of new benefits to the site visitors and to me in terms of organizing and delivering all the
                                                                                                                • How to set custom Sales Order numbers

                                                                                                                  I am trying to create Sales Orders with data from Jotform submissions. Auto number generation is disabled within Books. Whereas the flow Input recognizes the number (40732 in this example), the Output does not. How can I fix this? I'd like the number
                                                                                                                • What's New in Zoho Inventory | January - March 2026

                                                                                                                  Hello users, The first quarter of 2026 has been dynamic! We’ve shipped a powerful set of updates in Zoho Inventory to enhance item control, improve warehouse efficiency, expand integration and reporting capabilities. From a unified item creation experience
                                                                                                                • Zoho Commerce - Mobile App Order Creation

                                                                                                                  Hi Commerce team, I would like to suggest a feature for the mobile app that would make it much easier to create and process orders on the go. Problem Currently, while it is possible to create a Sales Order in Zoho Inventory, the process is not optimised
                                                                                                                • Zoho books - Project Module - Itemised expenses

                                                                                                                  Hi All, I heavily use the projects function in Zoho books and can work for one client for successive weeks, providing labour and incurring the occasional general expenses.  As an example, during the one purchase, I purchase 10 widgets and of these 10, 
                                                                                                                • Integrating FaceBook Ads into MarketingHub

                                                                                                                  I would like to track the clicks from a FB Ad campaign into my website via marketinghub.  I cannot currently add a MH form directly to my FB page, as I receive an error telling me I need at least 2000 subscribers on FB to be allows to do that (yikes!) What is the best way to set up MH so I can track which FB are converting well?  I know I can reach the FB reports directly, but these do not track conversions from the MH forms on my website. Best regards, Joe
                                                                                                                • Urgent Security Feature Request – Add MFA to Zoho Projects Client Portal Hello Zoho Projects Team,

                                                                                                                  Hello Zoho Projects Team, We hope you are doing well. We would like to submit an urgent security enhancement request regarding the Zoho Projects Client Portal. At this time, as far as we are aware, there is no Multi-Factor Authentication (MFA) available
                                                                                                                • Full Module-Level Access Control for Custom Profiles in Zoho Projects

                                                                                                                  Hello Zoho Projects Team, We hope you are doing well. We would like to submit a feature request regarding access control limitations in custom user profiles within Zoho Projects. Current Behavior: We created a custom profile intended for support agents,
                                                                                                                • How to save custom report for future use ?

                                                                                                                  Dear, How to save custom report for future use ? Thanks & Regards Shamnad 94460055258
                                                                                                                • Need to be able to save Customized Reports

                                                                                                                  There are several standard reports in zoho books.  Each of these can be 'customized' with various parameters - BUT, these cannot be saved for re-use later. In several of the zoho modules you can customize a search list (eg for Estimates or Invoices etc)
                                                                                                                • Split Bills/Expsense between multiple projects and/or clients

                                                                                                                  I need to be able to split vendor invoices/ expenses between multiple clients. Entering the bill multiple times is not only time consuming, it defeats the purpose of having a unquie identifity bill number and will allow for possible duplicated entry.  Below is an example from Quickbooks Desktop. Splitting costs over various projects is a common job costing function that I am very sad and surprised is not an option in Zoho Books. Unless I am missing it somewhere? Thanks for your help!
                                                                                                                • Vendor bills cannot be assigned to a customer or a customer project?

                                                                                                                  I'm confused on how to handle outsourced contractor expenses on a customer project.  Between my business and the contractor, the invoice they send me fits obviously into Zoho Books as a Bill. However, I need to be able record those expenses to the client
                                                                                                                • A few suggestions for Zoho Books

                                                                                                                  Hello. I've been evaluating Zoho Books for a small law firm practice. The interface is solid and I like the integration of accounting and time tracking, which is hard to find among cloud based services. I have a few suggestions that would be very helpful in determining whether we can adopt Zoho Books: 1. Be able to assign bills to clients/projects. Quickbooks desktop allows this and is very helpful in keeping track of bills that haven't been paid, but will be invoiced to clients as an expense. Creating
                                                                                                                • Book project costs to tasks

                                                                                                                  Hi all, New to zoho but far from new to this sort of platform. I've been scouring the web for a suitable platform for my growing business. I'm currently using Xero and WorkFlow Max but it lacks a key need. I signed up to zoho projects and books to test
                                                                                                                • Project expenses in Zoho Books

                                                                                                                  Just the way timesheet is used to calculate labour cost for a particular project, how do i record other expenses against a project such as materials and consumables used for the project? So that under report, I can view the total amount expended on each
                                                                                                                • Supplier Purchase Orders applied to a Project

                                                                                                                  We are finding it difficult to decide the best way track project expenses in Zoho books and would like to know how other users are handling this task. We provide Professional Services and engage 3rd party Suppliers on most projects and provide them with
                                                                                                                • Anyone using Books to track Project Profitability? If so, I could use some guidance

                                                                                                                  Hello Zoho Community. I am a recent subscriber to Zoho, and its part of an ongoing evaluation.  My company (and my clients) have extensive project-tracking needs.  The Projects module seems to be good from a project management standpoint, but I am perplexed
                                                                                                                • Deluge Error: "Data type of argument of function 'get' did not match required type [BIGINT]" when working with Lookup fields

                                                                                                                  Hi everyone, I’m facing an issue in Zoho CRM Deluge while working with lookup fields. Setup: Module: Monthly Bills Field: Customer (Lookup → Accounts) Module: Laundry Orders Field: Laundry_Account_Name (Lookup → Accounts) Field: Expected_Revenue (Currency)
                                                                                                                • Zoho TeamInbox stuck / unusable – possible orphaned organization?

                                                                                                                  Hi all, I’m running into an issue with Zoho TeamInbox under Zoho One Trial and wondering if anyone has seen this before. We’re trying to set up a shared inbox for orders (orders@), but TeamInbox appears to be in a broken state: • The app does not load
                                                                                                                • Audio transcript not working in Zoho notebook

                                                                                                                  Greetings all! I'm enjoying the Zoho notebook as I tested out over other notebook applications. I would really love the audio transcripts to work as that would save us a lot of time so that we can utilize the notes from an audio recording. Currently when
                                                                                                                • Re: Application Architecture in Zoho Creator — A Platform-Specific Deep Dive

                                                                                                                  A recent community post on application architecture made some excellent points about planning architecture early in Zoho Creator projects. The core message is right — Creator applications have a habit of growing organically into maintenance nightmares,
                                                                                                                • Schedule Timeout 5 minutes vs. stated 15 minutes

                                                                                                                  I am running into a function run timeout error after 5 minutes for my schedules. The Functions - Limits documents states it should be 15 minutes: Functions - Limits | Online Help - Zoho CRM. What should it actually be? Due to the 5 minute timeout, I'm
                                                                                                                • Next Page