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

    • Email Address for Contact not Populating

      When I click "Send Mail" from a Contact's page, their email address does not auto populate the "To" field. How do I make this happen?
    • New in CRM: Dynamic filters for lookup fields

      Last modified on Oct 28, 2024: This feature was initially available only through Early Access upon request. It is now available to all users across all data centers, except for the IN DC. Users in the IN DC can temporarily request access using this form
    • Why hybrid project management might be the best fit for you?

      Project management techniques are designed to equip teams with proven methods for easy and efficient project execution. While management teams may have apprehensions about adopting the hybrid method of project management, we’ve compiled the top reasons
    • Allow all Company Users to view all projects, but only owner/admins can change projects

      I was wondering if there was a permission setting I could adjust to allow all our company users to see all projects created. Then, only the project owners and admins with the change permission. Thanks
    • Fail to send Email by deluge

      Hi, today I gonna update some email include details in deluge, while this msg pops up and restrict me to save but my rules has run for one year. can you tell me how to use one of our admin account or super admin account to send the email? I tried to update
    • Seeking help to be able to search on all custom functions that are defined

      Hello I have a lot of custom functions defined (around 200) and i would like to search some specific strings in the content of those. Is there a way to accomplish that? If not, is there a way to download all existing custom functions in some files locally
    • Totals for Sales Tax Report

      On the sales tax report, the column totals aren't shown for any column other than Total Tax. I can't think of a good reason that they shouldn't be included for the other columns, as well. It would help me with my returns, for sure. It seems ludicrous
    • Add Bulk Section / Grid Layout Duplicate Feature in Zoho Forms Builder

      Currently in Zoho Forms, users can only duplicate individual fields. There is no option to duplicate an entire section or two-column/grid layout with all internal fields. This becomes inefficient when building structured forms such as Family Details,
    • Leistungsdatum in Rechnungen (Zoho Books)

      Hallo, ist es irgendwie möglich den Leistungszeitraum in der Rechnung aufzuführen? Beste Grüße Aleks
    • Zoho Trident Windows - Streams Not Visible

      Namaste We’re having an issue with Streams not being visible in Trident (Windows), which is important for us as we share many emails internally. It appears that the feature to show Streams above the Inbox folder, as seen in the default mailbox view, is
    • Sales IQ Chat Widget is Only Displaying Last Name

      Can anyone suggest why the widget is only displaying "last name"?! We have the latest version of the wordpress plugin installed. Thanks Thanks!
    • Shopify - Item sync from Zoho Inventory

      Hi team, We’ve connected Shopify with Zoho Inventory. We want that when an item is created in Zoho Inventory, it must create a product in Shopify. But currently, new items created in Zoho Inventory are not getting created in Shopify even after clicking
    • Bulk upload image option in Zoho Commerce

      I dont know if I am not looking into it properly but is there no option to bulk upload images along with the products? Like after you upload the products, I will have to upload images one by one again? Can someone help me out here? And what should I enter
    • Is it possible to setup bin locations WITHOUT mandating batch tracking?

      Hi fellow zoho users, I'm wondering if anyone else has a similar issue to me? I only have some products batch tracked (items with shelf life expiry dates) but I am trying to setup bin locations for my entire inventory so we can do stock counting easier.
    • Kill zoho meeting

      Saying the quiet part out loud. Can zoho please just give up on the idea that they can make a meeting platform and just make our workplace licenses cheaper when you remove it so people can switch to zoom or teams. Tired of the excuses, you guys cant make
    • Utilisation de Zoho en conformité avec l’article 286 du Code général des impôts (CGI)

      Cher(e) client(e), Conformément à l’article 286 du Code général des impôts (CGI) impose aux entreprises assujetties à la TVA d’utiliser des systèmes de caisse ou de gestion commerciale certifiés lorsqu’elles enregistrent des ventes à des particuliers.
    • Unable to Create Task as a Support Administrator

      Hello! I want to ask for help regarding creating tasks within the tickets. I am by default the Support Admin. I should be able to create tasks or activities right? But there's a prompt that I need to contact the Administrator. See photos for reference.
    • Introducing Forms in Zoho Sheet

      We hereby bring you the power of ​forms in Zoho Sheet. ​Now, build and create your own customized forms using Zoho Sheet. Be it compiling a questionnaire or rolling out a survey, Zoho Sheet can do it all for you. Forms is an excellent feature that helps you collect information in the simplest of ways and having it in Zoho Sheet takes it a notch higher. Build Simple yet Powerful forms Building forms using Zoho Sheet is fairly simple. The exclusive 'Form' tab lets you create one quickly. Whether you
    • Layout one survey question in a time & redirect next Page based on previous response

      I have doubt while, I am scripting survey on the Zoho where I redirecting to next page based on my previous response but didn’t get success on this. Please help me on this and tell me how I layout one survey questions in a time when I submit response
    • Zoho Bookings form pre-filled with Zoho Forms in

      Hi, I've got a contact page on my website and I'd like to have the option to book an appointment (redirected to zoho bookings page) after an option is submitted on the contact form. how would I go about doing this? thanks
    • Support “Other” Option with Free Text in Dropdown Fields

      Hello Zoho Bookings Team, Greetings, We would like to request an enhancement to the registration form fields in Zoho Bookings, specifically for dropdown fields. Current Limitation: At the moment, dropdown fields do not support an “Other” option that allows
    • ZOHO add-in issue

      I cannot connect ZOHO from my Outlook. I am getting this error.
    • Sending automated messages that appear in the ticket's conversation thread

      Good morning, esteemed Zoho Desk community, warm greetings Today I am here to raise the following problem, seeking a solution that I can implement: I need to implement an automation that allows me to send reminder messages to customers when I am waiting
    • Introducing parent-child ticketing in Zoho Desk [Early access]

      Hello Zoho Desk users! We have introduced the parent-child ticketing system to help customer service teams ensure efficient resolution of issues involving multiple, related tickets. You can now combine repetitive and interconnected tickets into parent-child
    • Payment Card or Identity form-fill from Vault?

      Hello! I'm working on replacing Bitwarden with Vault and one issue I've run into is that I can't find any option to fill address and payment forms from Payment Card or Identity info that has been saved in Vault. Is there a way to do this? Is it a planned
    • Ability to add VAT to Retainer Invoices

      Hello, I've had a telephone conversation a month ago with Dinesh on this topic and my request to allow for the addition of VAT on Retainer Invoices.  It's currently not possible to add VAT to Retainer Invoices and it was mutually agreed that there is absolutely no reason why there shouldn't be, especially as TAX LAW makes VAT mandatory on each invoice in Europe!   So basically, what i'm saying is that if you don't allow us to add VAT to Retainer Invoices, than the whole Retainer Invoices becomes
    • Time Log Reminder

      Tracking the time spent on tasks and issues is one of the most important functions of a timesheet. However, users may forget to update the time logs because they have their own goals to achieve. But, time logs must be updated at regular intervals to keep
    • [Early-access] Introducing Zoho's CommandCenter - Cross-Zoho business process automation

        Resources to help Webinar recording | Documentation  Feature Restrictions Currently available on early-access only for US data center accounts Features Role CommandCenter as a Service uses signals across Zoho services to propel the movement of records
    • Tip #58- Accessibility Controls in Zoho Assist: Learning- 'Insider Insights'

      Learning should be clear and interruption-free for everyone. Timely feedback plays an important role in helping users understand actions as they happen, without breaking their focus. In this post, we’ll explore the final section of Accessibility: Learning.
    • ZIA "Generate Content" action doesn't have contexual data from the ticket

      "Generate Content" action doesn't have contexual data from the ticket. I try to get AI to help me with this ticket but it doesn't seem to have any ticket information as context. Although the ticket has a lot of information in it.
    • Zoho Desk - Zoho FSM Integration issue on Mobile and iPad

      Hello Team, I am trying to create a Work Order (WO) using the Zoho FSM integration (Add-on Service) that is integrated with Zoho Desk. The issue is that the integration is not working on mobile devices and iPads. While I am able to create the WO, Request,
    • E-File Form 1099 Directly With the IRS From Zoho Books

      The Form 1099 filing season has begun, and businesses are required to e-file certain forms with the IRS to report payments made to vendors and contractors. If your business made qualifying payments during the year, you must e-file the appropriate Form
    • Can I hide empty Contact fields from view?

      Some contacts have a lot of empty fields, others are mostly filled. Is there a way I can hide/show empty fields without changing the actual Layout? I would like to de-clutter my view, and also be able to add information later as I am able. I would be willing to learn to code a button, but I am highly confused about it and thus worried it would be beyond me.  I've looked at a lot of the developer documents and I'm not able to make a lot of sense of them.  Thank you in advance to anyone who knows the
    • Suggestions for showing subscribed Topics in CRM (contact record)

      We have several Topics set up in ZMA. We also have a sync set up between ZMA and CRM. I'd like to display the subscribed topics on the CRM Contact record. This will allow the Sales team (who uses CRM) to see at a glance what topics a Contact is subscribed
    • Replies sometimes creating separate ticket

      Sometimes when a customer responds to an email coming from Zoho Desk, instead of adding a reply to the original ticket, a separate ticket is created. This happens even though the response subject line contained the ticket number, and the person responding
    • Re-hide fields when option is unselected

      Hi all Can anyone help me with this - when I create a 'show' field rule for when a dropdown option is selected, how to I make it so the 'show' option re-hides if that option is no longer selected?
    • Allow Attaching Quartz Recordings to Existing Zoho Support Tickets

      Hi Zoho Team, We would like to request an enhancement to how Zoho Quartz recordings integrate with Zoho Support tickets. Current Behavior: At the moment, each Quartz recording automatically creates a new support ticket. However, in many real-world scenarios:
    • I'm getting this error when I try to link an email to a deal inside the Zohomail Zoho CRM extension.

      When I click "Yes, associate," the system displays an "Oops!! Something went wrong" error message. I have attached a screenshot of the issue for reference.
    • Custom Fields

      There is no way to add a custom field in the "Timesheet" module. Honestly, the ability to add a custom field should be available in every module.
    • Remove the “One Migration Per User” Limitation in Zoho WorkDrive

      Hi Zoho WorkDrive Team, Hope you are doing well. We would like to raise a critical feature request regarding the Google Drive → Zoho WorkDrive migration process. Current Limitation: Zoho WorkDrive currently enforces a hard limitation: A Zoho WorkDrive
    • Next Page