Using ZRC in Client Script

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 post,

  1. What is ZRC?
  2.  ZRC Methods
  3. Use Case
  4. Solution
  5. Summary
  6. Related Links

1. What is ZRC?

Zoho Request Client (ZRC) is a built-in SDK in Zoho CRM that provides a unified way to make REST API calls across developer-centric features of Zoho CRM like Client Script, Widgets. Invoking CRM APIs, Connection APIs, and external APIs requires different syntax and separate code for each type. ZRC removes this complexity by offering one common and consistent approach to call all APIs, making client-side development easier and faster.

The following are the key features of ZRC.
  1. ZRC works with any CRM API version
  2. It supports self domain calls by providing only the API endpoint without specifying the domain
  3. Uses a single unified syntax for CRM APIs, custom Connections, and external public APIs. 
  4. No authentication handling needed for the same CRM org as ZRC manages it automatically
  5. Automatic JSON handling without manual parsing.
  6. Supports clean async code with full async-await and promise chaining.

2. ZRC Methods



Click here for more details about ZRC Methods.

3. Use Case - Log call notes and update the Lead status with a button click.

Quote
At Zylker, Salespersons often make multiple call attempts before connecting with a lead. Manually recording these attempts and updating the Lead status is often overlooked, leading to incomplete tracking and inaccurate pipeline data. To address this, the Admin wants the following changes:

1. Display a popup to capture call attempt details when a button is clicked and save them as a Note on the current Lead.

2. Also, update the Lead_Status of the current Lead to “Contacted” .

4. Solution

Here, the requirement is to create a note based on the Salesperson's description and update the status of the Lead record.To achieve this, Salesperson's input is collected through a pop-up when a custom button is clicked. The ZRC POST method is used to create a note for the Lead. The ZRC PUT method is used to update the status of the Lead record. As the Client Script has to be triggered with a button click, you should create a custom button and add Client Script from "Create Custom Button" pop-up.

  1. Go to Setup > Customization > Modules and Fields. Click Leads and navigate to "Buttons" tab.
  2. Specify the details about the custom button, Define action as "Client Script" and click Create.


  1. This opens Client Script IDE.
  2. Enter the following script and click Add in Client Script IDE. 
  1. // Validate if the script is running on a Lead record page
  2. if (!leadModule || !leadRecordId || leadModule !== 'Leads') {
  3.     ZDK.Client.showMessage('This script is designed to run exclusively on Lead record pages. Please navigate to a Lead record to use this feature.', { type: 'warning' });
  4.     return;
  5. }

  6. // Display a loader to indicate ongoing background operations
  7. ZDK.Client.showLoader({ message: 'Logging call attempt and creating follow-up actions...' });

  8. try {
  9.     // 1. Create a standardized Note attached to the Lead
  10.     var notes_content = ZDK.Client.getInput([{
  11.         type: 'text',
  12.         label: 'Log Call Details'
  13.     },
  14.     ], 'Log Call Details', 'OK', 'Cancel');
  15.     log(notes_content);
  16.     console.log({ notes_content });
  17.     const notePayload = {
  18.         data: [{
  19.             Note_Title: 'Call Attempt Log',
  20.             Note_Content: notes_content[0],
  21.             Parent_Id: { // Associate the note with the current Lead record
  22.                 id: leadRecordId,
  23.                 name: leadRecordName,
  24.                 module: {
  25.                     api_name: leadModule
  26.                 }
  27.             }
  28.         }]
  29.     };

  30.     const noteCreationResponse = await zrc.post('/crm/v8/Notes', notePayload);

  31.     // Check for successful note creation (200 OK or 201 Created)
  32.     if (noteCreationResponse.status !== 201 && noteCreationResponse.status !== 200) {
  33.         throw new Error('Failed to create Note: ' + JSON.stringify(noteCreationResponse.data));
  34.     }

  35.     // 2. Update the Lead_Status field to “Contacted” on the current Lead
  36.     const leadUpdatePayload = {
  37.         data: [{
  38.             id: $Page.record_id, // Specify the record to update
  39.             Status: 'Contacted'
  40.         }]
  41.     };
  42.     const leadUpdateResponse = await zrc.put(`/crm/v8/${leadModule}/${leadRecordId}`, leadUpdatePayload);
  43.     $Client.refresh();

  44.     // Check for successful lead status update (200 OK or 202 Accepted)
  45.     if (leadUpdateResponse.status !== 200 && leadUpdateResponse.status !== 202) {
  46.         throw new Error('Failed to update Lead Status: ' + JSON.stringify(leadUpdateResponse.data));
  47.     }

  48.     // Display a success message
  49.     ZDK.Client.showMessage('Call attempt logged, and Lead status updated', { type: 'success' });

  50. } catch (error) {
  51.     // Log and display an error message if any step fails
  52.     console.error('Error executing Log Call Attempt script:', error);
  53.     ZDK.Client.showMessage(`An error occurred: ${error.message}`, { type: 'error' });
  54. } finally {
  55.     // Always hide the loader, regardless of success or failure
  56.     ZDK.Client.hideLoader();
  57. }

  1. In the above script, $Page.module retrieves the current CRM module from which the script is executed.
  2. $Page.record_id fetches the unique ID of the record currently opened on the page.
  3. $Page.record provides access to the field values of the current record.
  4. ZDK.Client.showLoader() displays a visual loading message to inform the Salesperson that background operations are in progress.
  5. ZDK.Client.getInput() prompts the Salesperson to enter details about the call through an input dialog.
  6. ZRC.post() sends a POST request to Zoho CRM to create a new record and automatically handles authentication and domain resolution.
  7. In the notePayload,"Parent_Id" links the created note to the current CRM record and module.
  8. ZRC.put() sends a PUT request to Zoho CRM to update an existing record.
  9. $Client.refresh() refreshes the current CRM page so the latest updates are immediately visible to the Salesperson.
  10. Here is how Client Script works.




5. Summary

1. How to update a record in Zoho CRM using ZRC 
2. How to insert a record using ZRC



    Access your files securely from anywhere

        Zoho FSM Video Tutorials


              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

                                                                    • Announcing the new SKILL.md for Zoho CRM and the updated OAS repository!

                                                                      We are introducing a new zoho-crm skill to make working with Zoho CRM Developer tools (like APIs, functions, widgets, client scripts, queries etc) easier and faster, with the help of AI in your preferred AI harness like Claude Code, Codex, Cursor, VSCode
                                                                    • Kaizen #256 - Build an Arrival Readiness Web Tab in Zoho CRM

                                                                      Hi everyone! Welcome back to the Kaizen series! In the post, we discuss a use case in hospitality industry: how an Arrival Readiness web tab widget can be used to let reception staff identify and resolve issues before arrival of guests. Use case In the
                                                                    • 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


                                                                    Manage your brands on social media



                                                                          Zoho TeamInbox Resources



                                                                              Zoho CRM Plus Resources

                                                                                Zoho Books Resources


                                                                                  Zoho Billing 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

                                                                                                                        • Zoho CRM Layout Rules: Nine New Actions, Profile-Based Execution, and Interactive Preview

                                                                                                                          Hello everyone, Availability: This feature is now available for all users. We’re excited to announce powerful new enhancements to Layout Rules in Zoho CRM - a feature built to guide our teams through form-filling by showing the right information to the
                                                                                                                        • Vehicle Tracking

                                                                                                                          we have GPS devices that installed on our vehicles, and we would like to know if it's possible to  get vehicle live location data from the GPS device To Zoho Creator App.   Thank You
                                                                                                                        • Check out the new Checkbox in Zoho Sheet

                                                                                                                          Checkbox, the simple GUI widget that lets you choose between two mutually exclusive options i.e Yes or No, is now in Zoho Sheet. Having made it across the web, Checkbox is familiar but is still elusive to most spreadsheet software. Special developer ribbons, macros and all other complexities to add a checkbox to a spreadsheet? Not in Zoho Sheet. How to add Checkbox to Zoho Sheet? Adding a Checkbox in Zoho Sheet is simple. Select a cell/range and choose "Checkbox" in "Input Controls" under the Format
                                                                                                                        • I want to delete payment detail of my cards from the system.

                                                                                                                          I want to delete payment detail of my cards from the system.
                                                                                                                        • Custom Calendar View for a Custom Module in Zoho CRM

                                                                                                                          Hello everyone, I’m looking to create a calendar view (monthly grid, similar to Google Calendar) for a custom module in Zoho CRM, based on a date field within that module. The goal is to have a highly customized visual layout — colors depending on the
                                                                                                                        • Enhancements related to emails

                                                                                                                          Dear All, We hope you're well! We talked about the new email configuration in our previous announcement. In line with that, we're here with a few enhancements related to emails in Zoho CRM to improve how users view their emails and attachments from within
                                                                                                                        • Project Change Orders and Additions

                                                                                                                          We are in the process of migrating from QuickBooks Online to Zoho Books. We have Zoho One and like the ability to sync all of our data across everything. And I like that projects work in a way that's less dumb than QuickBooks. I'm trying to figure out
                                                                                                                        • How Can I Recover My Website After the August Spam Update?

                                                                                                                          Hi everyone, My website was hit quite badly during the August spam update 2026, and I'm trying to understand what I should do to recover it. My traffic and search visibility have dropped, but I'm not sure what exactly caused the problem. I have already
                                                                                                                        • Assembly Reporting in Composite Item View - Add 'Per-Unit Cost' Column

                                                                                                                          When a user in the UI goes to a Composite Item, looks under Transactions, and selects Assemblies, the screen below is shown. This is all good information, but one piece of very important data is missing... the per-unit cost. I realize that for those on
                                                                                                                        • Zoho Deluge Outage

                                                                                                                          Hello Enterprise Support Community, We wanted to make you aware that we are currently experiencing an outage affecting Zoho Deluge. Our developers are actively investigating the issue and working to restore service as quickly as possible. We apologize
                                                                                                                        • Impact/Best Practices when "US Zoho Services Availability - Incident, Zoho Deluge is down"

                                                                                                                          I've been seeing this more recently and I've been wondering exactly what that means/affects and how to best address it when it does. I can check for function failures, but are all function calls when this happens logged a failure, or are errors silently
                                                                                                                        • Day 2: Wait, where did everything go?

                                                                                                                          You log in the next morning, and the setup you finished yesterday is nowhere to be found. You are having a hard time finding your data. Here is where to look. In this post I logged in, and my data is gone. Where is it? I set things up, but I am looking
                                                                                                                        • Estimates or quotes in Inventory

                                                                                                                          Our pottery wholesale business is heavily inventory based. We are planning to switch from Quickbooks to Zoho Inventory which will be a great improvement on the "sales" side for in-house sales and salesreps. The only thing we are missing in Zoho Inventory
                                                                                                                        • CLIENT PORTAL (If clients can place orders directly on the portal)

                                                                                                                          Zoho client portal is excellent. Everything is there except one thing. Client should be able to place orders directly on the portal. This would enhance the portal and end users will be extremely happy. This suggestion infact came from one of our client.
                                                                                                                        • Deal win rate

                                                                                                                          Hi,  I would like to know something very simple, yet very important. Wath is the winning rate of the deals I've created. For exemple, what percentage of the deal i've close the last month where wins.  Would seems easy to find... but can see a report for that...  Help please. 
                                                                                                                        • Create Flexible Layouts with Layout Rules

                                                                                                                          In a project, when a work moves from planning to execution, the information teams need can change at every stage. A project can need one set of details, a phase can need another, and a custom process may require an entirely different set of information.
                                                                                                                        • Zoho Team Inbox - roadmap

                                                                                                                          Hi, would be good to understand the Teaminbox roadmap, in particular: 1. API / Zoho Deluge connections. We have a process where the each email needs to be either tagged or assigned daily. It would be great if we could automate a 5pm alert for any exemptions
                                                                                                                        • Conditional branching in Zoho Desk with Automation Studio

                                                                                                                          Hello everyone, We are introducing conditional branching that will allow businesses to manage complex, multi-condition workflows for customer service processes using Automation Studio. The primary goal is to create multi-branched logic in a single rule.
                                                                                                                        • Custom Function to increment a value by one

                                                                                                                          Hi, I'm trying to find a solution to set up a counter on CRM records that tracks how many times certain actions have taken place. As a specific example: We have a field on Deals called "Times Close Updated". This starts at 0 on record creation. I'd like
                                                                                                                        • Guide customers to the right booking page with routing forms

                                                                                                                          Greetings from the Zoho Bookings team! We're excited to introduce Routing Forms in Zoho Bookings. Routing forms let you collect information from customers before they schedule an appointment and automatically direct them to the most appropriate booking
                                                                                                                        • One flow for fulfillment exceptions across CRM, Inventory, and Desk | Kiosk Studio Session #11

                                                                                                                          Hello folks, Some orders get flagged in the fulfillment stage. One is short by six units, with nothing from the warehouse explaining why. Another shipped in full three days ago and still reads as pending, because the carrier never posted a scan. A third
                                                                                                                        • Zoho CRM Community Digest - August 2026 | Part 2

                                                                                                                          Hello everyone! August's second half brought a strong set of updates to Zoho CRM. The Functions experience gets a complete redesign, Incentives brings commission management natively inside the platform, and Dashboards pick up four focused improvements.
                                                                                                                        • Spam Control in Zoho Mail: Manage and Filter Incoming Emails for Your Organization

                                                                                                                          Unwanted emails are a common challenge for organizations of all sizes. Without a structured spam control system, spam emails can flood user inboxes, expose sensitive data, and disrupt communication. Zoho Mail's Spam Control feature gives administrators
                                                                                                                        • [Webinar] Automating document review and approval workflows

                                                                                                                          Live webinar on September 10, 2026 | Time: 2 PM IST | 2 PM EDT Hi, Still juggling multiple tools, chasing approvers manually, and losing visibility into where your documents stand? Join our live webinar to learn how Zoho Writer's built-in workflow engine
                                                                                                                        • Version Control and Git Integration for Zoho Creator Applications

                                                                                                                          As Zoho Creator applications grow in complexity, managing code changes, tracking history, and collaborating across developers becomes increasingly difficult. Currently there is no native way to: Track what changed, when, and by whom across Deluge functions,
                                                                                                                        • Zoho Inventory - Imporoved Order Fulfillment Reporting

                                                                                                                          Hi Inventory Team, i've tried to contact you through support@eu.zohoinventory.com but haven't received a response. I am contacting you on behalf of a client. Our client is a car parts wholesale business and we set them up on Zoho Inventory earlier this
                                                                                                                        • Zoho Webinar - Sharing System Audio (NOT AVAILABLE)

                                                                                                                          Hi, We are having a serious problem with Zoho Webinar. In the webinars we run, we very often share the audio from a video we are streaming directly from YouTube or other applications. Until recently we were using Zoom, but as we use other Zoho applications
                                                                                                                        • Phone field Zoho CRM E.164 format

                                                                                                                          Hi, We have a webhook triggered flow in Zoho Flow which creates a lead in Zoho CRM. However, the phone format is not always in E.164 format. How can I solve this problem? Do I need a custom function within Zoho Flow or in Zoho CRM? So the following formats
                                                                                                                        • Workshops Zoho – 5 & 6 novembre 2026 | Paris

                                                                                                                          Les Workshops Zoho reviennent en France avec une édition pensée pour tous les niveaux ! Les 5 et 6 novembre, nous vous donnons rendez-vous au Mercure Hôtel Paris Porte de Versailles Expo pour deux jours de formation pratique, de démonstrations en direct
                                                                                                                        • Stock Based Sort-by option in Category Pages

                                                                                                                          In a category page product with In-Stock should come in the top of the categories product list rather than out-of-stock products. No having this option is extremely disappointing, I made the initial request about 7 months ago but still not even an update
                                                                                                                        • Zoho Books - France

                                                                                                                          L’équipe de Zoho France reçoit régulièrement des questions sur la conformité de ses applications de finances (Zoho Books/ Zoho Invoice) pour le marché français. Voici quelques points pour clarifier la question : Zoho Books est un logiciel de comptabilité
                                                                                                                        • Editting PDF in Zoho online editor doesnt work

                                                                                                                          I just tried editting a simple 3 page PDF but it opens up blank. I dont see any errors or feedback if something went wrong
                                                                                                                        • Uploaded Documents are Distorted

                                                                                                                          I needed to combine 2 documents into 1 PDF. When I uploaded a document that was a scanned copy of a physical document into the Zoho PDF Editor, it is all distorted/image quality is all whited out even though the file I uploaded was perfectly clear.
                                                                                                                        • Delete CRM Portal

                                                                                                                          How do I delete portals from my CRM? I created one just to test, it is not in use and is disabled but it's existence is preventing me from marking fields in modules as "required" unless I make it 'read/write' in the portal first. I'd rather just delete
                                                                                                                        • Zoho One: books and inventory working together

                                                                                                                          Hi, I was very pleased when I saw that in Zoho Inventory can now pull the orders from Woocommerce. They are now fed in Inventory as Sales order and with choosing convert invoice as Instant Invoice I am getting the exact data as they appear in Woocommerce.
                                                                                                                        • 【Zoho CRM】承認プロセスのアップデート | ステージごとの処理設定や承認履歴を強化

                                                                                                                          ユーザーの皆さま、こんにちは。コミュニティグループの中野です。 Zoho CRMの承認プロセス機能がアップデートされましたのでご紹介します。 今回のアップデートにより、承認ルールや承認ステージに名前を付けられるようになったほか、 承認ごとの項目更新やタスクの割り当て、却下時の通知、承認履歴の確認方法などが改善されました。 今回は、総額100万円以上の商談を特定の役職者(マネージャーとCEO)が順番に確認する承認プロセスを例にご紹介します。 目次 承認プロセスに追加するルールや、承認ステージに名前を付けられるように
                                                                                                                        • Pass variables to Zoho Desk via URL to create a fast new ticket landing page

                                                                                                                          We are integrating our phone system into Zoho Desk. Currently when a helpdesk agent answers the phone, a soft client opens a new tab with zoho desk at the new case page. https://desk.zoho.com/support/companyname/ShowHomePage.do#Cases/new We would like
                                                                                                                        • Pulling data from lookup fields

                                                                                                                          If I try to pull in CRM data from a lookup field, it only shows a number and not the actual name. Is there a way to get around this? It impossible to do reports using lookup field data.
                                                                                                                        • Display a field of an Account on the Ticket view

                                                                                                                          Hi there, We would like to display of the Account of the user submitting a ticket on the ticket view. See for example: How can this be achieved? It doesn't really matter where it will be placed as long as it is shown there. Thanks, Snir
                                                                                                                        • Have a Zoho Desk PDF Attachment Show on the Ticket Screen rather than having to download it.

                                                                                                                          We are using a system that emails out a report in PDF format to Zoho Desk for our staff to review but it's difficult to have to download the PDF attachment each time, we would like for there to be some sort a viewer below the ticket that shows the contents
                                                                                                                        • Next Page