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



    • 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
    • Recent Topics

    • Allow Reauthorizing CRM Connections Without Revoking First

      Currently, when a Zoho CRM connection needs to be reauthorized or authorized with another account, we first have to revoke the existing authorization and then authorize it again. This creates a gap where the connection is unavailable, and any functions,
    • Global Sets for Multi-Select pick lists

      When is this feature coming to Zoho CRM? It would be very useful now we have got used to having it for the normal pick lists.
    • Zoho Projects - Mobile App - Creating Related Issue On Task View

      Hi Projects Team, I'm working with a client who wants to use Zoho Projects for their field service work. So far it is working find (and I am aware of FSM, but the client is happy with Projects). One thing they have raise with me as a frustration is that
    • 👍 Zoho CRM's Notes now gets Reactions and a new look

      Available in SA and JP DCs. Rolling out to other DCs in phases. Hello everyone, Notes help users capture important updates, collaborate with teammates, and maintain context for records. Now with Note Reactions, users can quickly acknowledge updates, express
    • Track All Emails from Company Domain

      For our business model, it's almost impossible to keep track of all emails sent to clients, under the way ZohoCRM currently tracks emails to customer records via the user account only. We'd like to see a way of tracking emails via domain only, separate
    • Zoho Assist Remote Desktop on Android grey screen

      With Zoho Assist Remote Desktop for Android when I connect to an unattended device I see only a Grey Screen. It worked fine before. This is a recently issue. I tried to clean data and cache, reinstall app, try and old version... but nothing. Always grey
    • Cannot format "start date" field in Zoho Flow

      I am trying to recreate a flow that connects Inventory package creation to Zoho projects (where a task is created in a defined project). I've been able to troubleshoot everything EXCEPT the date fields; specifically the "start date" - which is quite important
    • Introducing Incentives for Zoho CRM: Build, automate, and track sales commissions

      Dear Customers, We are here with an amazing news! We built a direct solution to help manage your commission provisioning activity in your business. From creating commission plans to issuing payouts, this application leverages your sales reps’ performance
    • Dark Mode for ZOHO Recruit

      Please make a dark mode for ZOHO Recruit. The white is SO BRIGHT!
    • Dashboards for Customers

      Is it possible to build dashboards for each customers in the community for their tickets?
    • Feature Request - Dedicated "Avail" action for Restricted Holidays (instead of routing through Apply Leave)

      Currently, Restricted Holidays in Zoho People are handled through the Leave module. Employees have to go through Apply Leave and select the Restricted Holiday as a Leave Type in order to avail it. From an HR perspective, a Restricted Holiday isn't really
    • Deleting invoice (not syncing with Xero)

      If I delete an invoice or Bill in Zoho Inventory, it doesn't sync with Xero. So my Xero accounts are not correct. Whats the point of being able to delete a transaction in Zoho if it doesn't sync to my accounting package? How can I do this?
    • Allow Clients to choose which meeting platform works best for them

      Hi! I have a feature request for Zoho Bookings! I currently have multiple online meeting platforms connected to Zoho Bookings: Zoho Meeting, Zoom Meetings and Teams Meetings. Since we are allowed to connect multiple meeting platforms, it would only make
    • Implement Meeting Polls in Zoho Bookings

      Dear Zoho Bookings Support Team, We'd like to propose a feature enhancement related to appointment scheduling within Zoho Bookings. Current Functionality: Zoho Bookings excels at streamlining individual appointment scheduling. Users can set availability
    • Previewing attachments in email composer (Zoho CRM)

      When I am sending an email from a contact's record, when I am in the compose email screen, if I add an attachment to the email, I cannot then click on the attachment to view it to see if it is in fact the correct attachment before sending. In Outlook
    • Zoho Lens Feature Update: September 2026

      RealWear store support Zoho Lens is now listed on the RealWear marketplace, paving the way for quick and easy deployments. Install it straight to your smart glasses from the marketplace without any cables, pendrives, or manual transfers.
    • How are you using AI task management tools in your team

      AI is becoming more useful when it can do more than suggest tasks. Having AI agents help with task updates, follow-ups, and repetitive project work could make day-to-day collaboration much smoother. I recently came across Sharkly.ai, which focuses on
    • Can Zoho Mail Be Used with Google Workspace Without Migrating Emails?

      Hello Zoho Community, We currently use Google Workspace for our company emails and do not want to migrate our email accounts or data to Zoho Mail. However, we would like to use Zoho Mail as an email client, similar to Microsoft Outlook, by connecting
    • Topic assignment to a contact list never completes in Zoho Campaigns

      Hello, I am experiencing an issue in Zoho Campaigns when trying to assign a Topic to a contact list. When I select a list and try to assign a Topic, Zoho displays the following message: “This process will take a few minutes. You will receive an email
    • Subforms and automation

      If a user updates a field how do we create an automation etc. We have a field for returned parts and i want to get an email when that field is ticked. How please as Zoho tells me no automation on subforms. The Reason- Why having waited for ever for FSM
    • [ZohoDesk] Improve Status View with a new editeble kanban view

      A kanban view with more information about the ticket and the contact who created the ticket would be valueble. I would like to edit the fields with the ones i like to see at one glance. Like in CRM where you can edit the canvas view, i would like to edit
    • 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,
    • Zoho Assist Feature Update: September 2026

      Custom View Filters in Scheduled Reports Scheduled Custom Reports now support saved Views. Select a View when setting up your schedule, and only the data matching its filter criteria will be delivered to recipients in each email. Without a selected View,
    • Tip #89 – Access, print, and manage remote files from your local printer with Remote Printing – 'Insider Insights'

      A team member working from home urgently needs a document that's sitting on the office system. The office is locked and nobody is around to access it. Emailing the file means routing a sensitive document through external channels, and that's not something
    • Important: Teamwork Projects Integration Moving to API v3

      Hello Teamwork Project users, We are migrating the Teamwork Projects integration from the legacy V1 API to V3 API. This upgrade enables support for custom fields from Teamwork Projects, allowing users to import custom modules and fields into Zoho Analytics
    • Introducing Night Mode for Zoho Recruit [BETA]

      Late-night hiring sessions? Long hours reviewing resumes? We heard you. Night mode [BETA] is now available in Zoho Recruit, giving you a cleaner, more comfortable workspace that’s easier on the eyes while keeping the focus on what matters most: hiring.
    • Sent Items folders not syncing on Thunderbird

      HI,  I run TB on multiple devices, since the middle of September all the devices have stopped synchronising the sent items folders, all mail is received and sent correctly and stored in my zoho webfolders. I haven't changed any of the settings. Any ideas? This is also the case in my 'paid for' accounts with ZOHO and Thunderbird Many thanks Tony whittingham
    • Thunderbird not retrieving Mail automatically

      Hi, I have set up Zoho in Thunderbird all fine, the only problem is that the mails are not coming to Thunderbird automatically, they only come when I initially start up Thunderbird,  any ideas for a fix on this cheers
    • Free Webinar Alert! Don’t take the bait: Everyday email safety in Zoho Mail

      Hello Zoho Community! Think you can spot a suspicious email before it catches you off guard? Join our upcoming webinar, “Don’t take the bait: Everyday email safety in Zoho Mail,” and learn how to recognize common email threats and build safer habits for
    • Do you know which 20% of your products generate 80% of your revenue?

      Not all products earn their place in your inventory. In almost every catalog, a small group of items drives most of the revenue, while a long tail quietly ties up storage, counting effort, and working capital. The trouble is, most teams treat every SKU
    • How can we allocate incoming PO stock to Sales Orders, and does Backorder automatically reserve it upon receipt?

      Hello Everyone, We want to allocate incoming Purchase Order quantities to specific Sales Orders before the stock arrives. For example, from an existing PO of 100 pieces: 40 pieces assigned to SO-A. 35 pieces assigned to SO-B. 25 pieces left unallocated.
    • Convert an Existing Single Item into an Item with Variants

      Hello Zoho Team, Introducing variants is a great addition to Zoho Inventory. However, we would like to request an option to convert an existing single item into an item with variants. For example, Item A initially comes in only one colour, so we create
    • inventory removal at packing list or shipment.

      currently our system is set to remove inventory at invoice. This is creating an inventory nightmare? Is it possible to change the settings to remove the item from inventory at either the packing slip stage or shipping the item.
    • Delug script

      I have been looking at auto-update a amount (home currency) field from another module. Zoho native multicurrency was used in the other module (we have 4 here). Custom script was input with no error, but the field was not updated on trigger. Script as
    • Zoho Desk API modifiedTimeRange returns HTTP 500 around 2026-03-08T02:00:00.000Z

      Hello Zoho Support Team, We are experiencing a reproducible HTTP 500 Internal Server Error when querying the Zoho Desk API search endpoint with a specific modifiedTimeRange boundary. ### API Endpoint GET /api/v1/tickets/search ### Reproduction Steps &
    • Allow Email Attachments to Be Opened Directly in Zoho CRM

      Hi all, It would be very helpful if attachments linked to an email in Zoho CRM could be clicked and opened directly from the email preview. Currently, the attachment names are displayed, but the experience of viewing them is unnecessarily limited. Users
    • GEO and Zoho Desk

      Has anyone done anything with GEO (generative engine optimization) and zoho desk KB? Are there any plans from Zoho on adding the ability in inject GEO scripts in KB Articles?
    • How to add custom lookup-type field to meeting module form in Zoho CRM

      We need to have a lookup field to a custom module's record in Zoho CRM. But it appears that look-up fields are not enabled in Meetings/Events module in Zoho CRM. How do I design/implement a custom look-up type field that will lookup records from custom
    • AI-Powered Automation for Repetitive Tasks

      Incorporating AI into Zoho People can streamline and automate repetitive administrative tasks, boosting productivity and efficiency. Automate Data Entry: Use AI to auto-capture and input data from emails and forms, reducing errors. Schedule Management:
    • Rotate an Image in Workdrive Image Editor

      I don't know if I'm just missing something, but my team needs a way to rotate images in Workdrive and save them at that new orientation. For example one of our ground crew members will take photos of job sites vertically (9:16) on his phone and upload
    • Next Page