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. // Retrieve current Lead module and record ID from the page context
  2. const leadModule = $Page.module;
  3. const leadRecordId = $Page.record_id;
  4. const leadRecordName = $Page.record.Lead_Name || $Page.record.Full_Name || 'Lead Record';
  5. // Dynamically get lead name
  6. // Display a loader to indicate ongoing background operations
  7. ZDK.Client.showLoader({
  8. message: 'Logging call attempt and updating Status'
  9. });
  10. try{
  11. // 1. Create a standardized Note attached to the Lead
  12. var notes_content = ZDK.Client.getInput([{
  13. type: 'text',
  14. label: 'Log Call Details'
  15. },
  16. ], 'Log Call Details', 'OK', 'Cancel');
  17. log(notes_content);
  18. console.log({
  19. notes_content
  20. });
  21. const notePayload = {
  22. data: [{
  23. Note_Title: 'Call Attempt Log',
  24. Note_Content: notes_content[0],
  25. Parent_Id: {
  26. // Associate the note with the current Lead record
  27. id: leadRecordId,
  28. name: leadRecordName,
  29. module: {
  30. api_name: leadModule
  31. }
  32. }
  33. }]
  34. };
  35. const noteCreationResponse = await zrc.post('/crm/v8/Notes', notePayload);
  36. // Check for successful note creation (200 OK or 201 Created)
  37. if(noteCreationResponse.status !== 201 && noteCreationResponse.status !== 200) {
  38. throw new Error('Failed to create Note: ' + JSON.stringify(noteCreationResponse.data));
  39. }
  40. // 2. Update the Lead_Status field to “Contacted” on the current Lead
  41. const leadUpdatePayload = {
  42. data: [{
  43. id: $Page.record_id, 
  44. // Specify the record to update
  45. Status: 'Contacted'
  46. }]
  47. };
  48. const leadUpdateResponse = await zrc.put(`/crm/v8/${leadModule}/${leadRecordId}`, leadUpdatePayload);
  49. $Client.refresh();
  50. // Check for successful lead status update (200 OK or 202 Accepted)
  51. if(leadUpdateResponse.status !== 200 && leadUpdateResponse.status !== 202) {
  52. throw new Error('Failed to update Lead Status: ' + JSON.stringify(leadUpdateResponse.data));
  53. }

  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

    • 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
    • Kaizen #152 - Client Script Support for the new Canvas Record Forms

      Hello everyone! Have you ever wanted to trigger actions on click of a canvas button, icon, or text mandatory forms in Create/Edit and Clone Pages? Have you ever wanted to control how elements behave on the new Canvas Record Forms? This can be achieved
      • Recent Topics

      • System default SLA descriptions can't be modified

        The system default SLAs have identical descriptions for all SLA levels, but their settings differ. However, I am facing an issue where I cannot modify these descriptions and save the changes. The content of the description box can be edited but the changes
      • Adding non-Indian billing address for my Zoho subscription

        Hey Need help with adding a non-Indian billing address for my Zoho subscription, trying to edit the address to my Singapore registered company. Won't let me change the country. Would appreciate the help. Regards, Rishabh
      • How to create one ZohoCRM organisation out of a multi-organization?

        Hi, we have a multi-org including two different Zoho CRM organizations for two companies using respectively EUR and USD as default currency. I was wondering if there is any easy way to merge the two organizations into just one, so that users may access
      • Gray screen while signing documents

        We are all getting a "gray" screen when trying to sign documents in Zoho sign. Anyone else having issues?
      • Designing a practical Zoho setup for a small business: lessons from a real implementation

        I recently finished setting up a Zoho-based operating system for a small but growing consumer beauty business (GlowAtHomeBeauty), and I wanted to share a practical takeaway for other founders and implementers. The business wasn’t failing because of lack
      • Link Purchase Order to Deal

        Zoho Books directly syncs with contacts, vendors and products in Zoho CRM including field mapping. Is there any way to associate vendor purchase orders with deals, so that we can calculate our profit margin for each deal with connected sales invoices
      • Projects custom colors replaced by default orange

        Since yesterday, projects uploaded to Zoho, to which I had assigned a custom color, have lost the customization and reverted to the default color (orange). Has anyone else had the same problem? If so, how did you resolve it?
      • Interview booked through Invite but no Notifications

        We have a workflow that was developed through a developer/partner that was tested and worked. Today, we pushed a candidate through the process and invited them to an in-office interview. They were sent the booking link (as usual and as tested before successfully)
      • WebDAV support

        I need WebDAV support so that I can upload/download (and modify) documents from my local file system. Is anything planned in his direction?
      • Automatiser la gestion des SLA dans Zoho Desk avec Zoho Contracts

        Les équipes du service client s’efforcent d’assurer un support rapide, régulier et fiable pour garantir la satisfaction de chaque client. Les accords de niveau de service (SLA) permettent de clarifier les engagements en définissant les termes et conditions
      • iOS App doesn't refresh for Document Creation

        Hello Zoho team, I have created a workflow to be used on a mobile iOS device which starts in Zoho Creater and ends with a murge and store function that then opens the newly created document within the Zoho Writer app. This process is working great however
      • Uploading a signed template from Sign to Creator

        Good day, Please help me on how to load a signed document back into Creator after the process has been completed in Sign. Below is the code that I am trying, pdfFile = response.toFile("SignedDocument_4901354000000372029.pdf"); info pdfFile; // Attach
      • Zoho DataPrep and File Pattern configuration

        I'm using Zoho data prep to ingest data from One Drive into Zoho Analytics... The pipeline is super simple but I can't any way to get all the files that I need. Basically I need to bring all the files with a certain pattern and for that I'm using a regex
      • Assistance needed: Activation of a domain

        Hello Zoho Support, I purchased the .com domain "primesolva.com" via Zoho 6 days ago. The domain is still pending, and I cannot access the DNS panel to add the TXT verification for domain ownership. Please confirm the registration status and help me activate
      • Operation not permitted

        I am trying to add an email address to the list of user but I am getting error Operation not permitted
      • Request to Permanently Delete Email User (info@mehbobgulf.com ) from Old Organization

        Please permanently delete the user email info@mehbobgulf.com It is still associated with my old Zoho organization. I cannot delete it because it shows ‘You cannot delete email. Zoho host’. I need to use this email in a new Zoho account.”
      • Client host [89.36.170.5] blocked using Spamhaus

        Hello please make make actions for delist ..... "Client host [89.36.170.5] blocked using Spamhaus"
      • Suggestion: Option to Re-run a migration

        As I'm going through a migration process, I like the IMAP migration tool, but it would be better if there were an option to re-run the same migration as configured. There's not even an option to copy/edit one that's already there. Just run if it hasn't
      • Issue with "Add Your Mobile Number"

        Hello, I am trying to sign up for email service for a domain name, and I cannot finish the authentication. When I enter my mobile number, I receive the message "We’re unable to send OTP to this mobile number. Please contact support-as@zohocorp.com". I
      • zoho mail non vérifié

        Bonjour, Il y'a un jour que j'ai acheté un domaine et toute les tentatives pour l'associé a mon compte shopify son vaine. j'ai essayé TXT sans suite après, j'ai essayer avec CNAME sans suite. j'aurais besoin de votre assistance pour associé mon mail.
      • Unable to send message;Reason:553 Relaying disallowed. Invalid Domain

        i have facing the issue "Unable to send message;Reason:553 Relaying disallowed. Invalid Domain" if i verify domain evertthing i did but still face the same error.
      • ZohoMail is so close to being Perfect BUT

        Why don’t you have HILIGHTING???!! I've been trying to find a substitute for Edison Mail but I want & need hilighting (preferably in more than just yellow)! Is this even on your To Do list? I’m so disappointed. 🙄
      • Override Auto Number field?

        We are preparing to migrate from Salesforce. In Salesforce, we auto-generate a unique number on our Opportunities (Potentials). If the Opportunity results in a contract, we use that unique number as the Contract number. There are some situations where
      • Using a third party service provider want to move directly with Zoho

        Hi good day I’m currently using Zoho but I’m using a third party service provider I want to move directly with you guys I’m using Zoho email and invoices and my domain please let me know if it’s possible to move away from the third party provider my email
      • Request for Assistance Regarding Email Sending Issue (554 5.1.8 - Email Outgoing Blocked)

        Dear Zoho Support Team, I hope this message finds you well. I am writing to request assistance with an issue we are currently facing regarding our Zoho Mail account. Our email account, admin@tuyensinhcanuoc.com, is encountering the following error when
      • Zoho Mail API returns empty inbox (0 messages) but webmail shows 37 unread emails

        Hello, I'm experiencing a discrepancy between Zoho Webmail and the Mail API (EU region). **Setup:** - Account: EU datacenter (mail.zoho.eu) - API: Self Client OAuth2 via api-console.zoho.eu - Scopes: ZohoMail.messages.READ, ZohoMail.messages.UPDATE, ZohoMail.folders.READ,
      • Zoho Mail not working

        Zoho Mail not working
      • ShipStation and Zoho Inventory

        Hello, I am looking to sync zoho inventory with shipstation ZOHO INVENTORY           SHIP STATION Sales Order  ==>  create ORDERS INVOICE  <==    Shipments What exactly does BETA mean on the Shipstation connector?  This is required for me to sign-on in the next month. Thanks in advance for your efforts
      • 550 5.4.6 Unusual sending activity detected. Please try after sometime

        Hi, I am receiving this error message when trying to send my emails. The only reason I can think why this is happening is my previous two emails were bounced back to me due to a non working mailbox error. I have followed the online links for unblocking but it says there are no blocks on my account. How and when can I get my email working again to send emails? Thanks,
      • How do I remove a data source from Zoho Analytics?

        I am unable to find a delte option on a datasource that i put in the system as an error. On teh web it refers to a setup icon but I do not see that on my interface?
      • E

        We are trying to add our Zoho Form embed in our Elementor Page Builder. After adding Zoho Forms widget in elementor page builder it’s displaying in backend page builder but it’s giving 403 error while trying to save, as it’s not reflecting in front end.
      • Kaizen #225 - Making Query-based Custom Related Lists Actionable with Lookups and Links

        Hello everyone! Welcome back to another post in the Kaizen series! This week, we will discuss an exciting enhancement in Queries in Zoho CRM. In Kaizen #190, we discussed how Queries bridge gaps where native related lists fall short and power custom related
      • Ability to Edit YouTube Video Title, Description & Thumbnail After Publishing

        Hi Zoho Social Team, How are you? We would like to request an enhancement to Zoho Social that enables users to edit YouTube video details after the video has already been published. Your team confirmed that while Zoho Social currently allows editing the
      • Formatting Problem | Export to Zoho Sheet View

        When I export data to Zoho Sheet View, ID columns are automatically formatted as scientific notation. Reformatting them to text changes the actual ID values. For example, 6557000335603071 becomes 6557000335603070. I have attached screenshots showing this
      • Connecting Zoho Inventory to ShipStation

        we are looking for someone to help connect via API shipStation with Zoho inventory. Any ideas? Thanks. Uri
      • Clone / Export Popup Design Across PageSense Projects

        Hello Zoho PageSense Team, We hope you’re doing well. We would like to request an enhancement that allows popup designs to be reused across different PageSense projects. Problem Statement: Currently, Zoho PageSense allows popups to be duplicated only
      • custom module import.

        Is there a way to import data into a custom module? Thanks Rudy
      • HEIC File Type Viewer

        Hi, It would be nice to be able to click on the images in the All Entries/Reports Tables which are HEIC the same as JPG, PNG, etc. so they open in a viewer from Zoho or the Attachment Service, today HEIC requires you to download each image and open it
      • Building Toppings #4 - Setting up and using connections in Bigin toppings

        When building a topping to extend Bigin's functionality and connect it with third-party applications, creating and handling connections is an important step. Connections provide a secure way for your topping to authenticate and communicate with other
      • Need code format to specify default values

        Can someone please direct me to the code syntax or the proper translation per the instructions circled below. These instructions don't seem correct.
      • Next Page