Kaizen #174 : Client Script Commands

Kaizen #174 : Client Script Commands


Hello everyone!

Client Script Commands feature is a highly anticipated functionality that enables users to trigger Client Scripts anywhere within Zoho CRM, extending the scope of client script beyond standard pages and events. In this Kaizen post, we'll explore how to implement and utilize this feature effectively.

In this post,


 

  1. What are Client Script Commands?

  2. How to create and use Client Script Commands?

    1. Using Command Palette

    2. Using Keyboard Shortcuts

  3. Scenario - 1

  4. Solution

  5. Scenario - 2

  6. Solution

  7. Summary

  8. Related Links

 


 

1. What are Client Script Commands?

Client Script Commands feature is another dimension of Client Script that enables users to trigger them anytime and anywhere in CRM, extending their event-driven functionality beyond just specific modules and pages. This functionality can be accessed through custom keyboard shortcuts or a command palette, making it easier for users to perform repetitive tasks quickly

2. How to create and use Client Script Commands?

Create a command by specifying the Category as Commands (instead of module) while creating a Client Script.




Check this documentation for more details.

To trigger a Command, you can use one of the following ways.

A. Using Command Palette
Click on the Command Palette icon in the footer of CRM and select the name of the Command that you want to trigger.



B. Using Keyboard shortcuts

You can also link each of the Commands to a shortcut key and trigger a Command using that designated shortcut key. Each user can set specific shortcuts based on individual preference and use them to trigger a Command.
Check this documentation for more details.

3. Scenario - 1

At Zylker, a financial company using Zoho CRM, Sales Advisors need a quick way to calculate EMI during customer phone calls. The solution should allow seamless access to an EMI Calculator from any page in Zoho CRM.

4. Solution

To achieve this in Zoho CRM,  you need to create a Widget for EMI calculator and create a Client Script Command.

A. Create a Widget for EMI calculator

  • Install Zoho CLI, and follow the steps given in this document to create the Widget app folder. Then update the html, javascript, and css code as per your requirement.

index.html

<!DOCTYPE html>

<html lang="en">

  <head>

    <meta charset="UTF-8" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Document</title>

    <link rel="stylesheet" href="style.css" />

  </head>

  <body>

    <div class="loan-calculator">

      <div class="top">

        <h2>EMI Calculator</h2>

        <form action="#">

          <div class="group">

            <div class="title">Amount</div>

            <input type="range" min="1000" value="30000" max="50000" step="500" class="loan-amount" id="loanAmount" />

            <div class="slider-label">$<span id="loanAmountValue"></span></div>

          </div>

          <div class="group">

            <div class="title">Interest Rate</div>

            <input type="range" min="5" value="6" max="100" step="1" class="interest-rate" id="interesRate" />

            <div class="slider-label"><span id="interesRateValue"></span></div>

          </div>

          <div class="group">

            <div class="title">Tenure (in months)</div>

            <input type="range" min="6" max="100" step="1" value="12" class="loan-tenure" id="tenureMonth" />

            <div class="slider-label"><span id="tenureMonthValue"></span></div>

          </div>

        </form>

      </div>

      <div class="result">

        <div class="left">

          <div class="loan-emi">

            <h3>Loan EMI</h3>

            <div class="value">123</div>

          </div>

          <div class="total-interest">

            <h3>Total Interest Payable</h3>

            <div class="value">1234</div>

          </div>

          <div class="total-amount">

            <h3>Total Amount</h3>

            <div class="value">12345</div>

        <div class="right">

          <canvas id="myChart" width="400" height="400"></canvas>

        </div>

      </div>

    </div>

    <script src="https://cdn.jsdelivr.net/npm/chart.js@3.6.2/dist/chart.min.js"></script>

    <script src="https://live.zwidgets.com/js-sdk/1.2/ZohoEmbededAppSDK.min.js"></script>

    <script src="main.js"></script>

  </body>

</html>

 

  • Click here to view the complete code.

  • Once you have added the code, upload the zip file by following the below steps.

  • Go to Setup > Developer Space > Widgets.

  • Click Create New Widget and Fill in the details.

 

  • The Hosting should be "Zoho" and mention the html page of the app folder that you uploaded.

 




Notes

Note:

The widget should be of "button" type in order to render through a Client Script.


B. Create Client Script Commands.

 

  • Configure a Client Script Command by specifying the Name and Description The Category should be Commands. Click Next. Click here to know how to configure a Client Script.

 

  • Enter the following script and click Save.



     ZDK.Client.openPopup({ api_name: 'emi_calculator', type: 'widget', header: 'EMI Calculator', animation_type: 4,  height: '750px', width: '500px', top:'100px',left: '500px' }, { data: 'sample data to be passed });



 

  • Here "emi_calculator" is the API name of the Widget,

    • Type is Widget,

    • Header is EMI Calculator,

    • animation type is 4 where the popup slides from the bottom.

    • The other parameters are optional and has default values as shown in the image.

  • Here is how the EMI Calculator appears as and when the salesperson needs. The user can either click on the Command Palette Icon at the footer or use a keyboard shortcut as per his convenience to open the calculator.


  • In the above gif, the keyboard shortcut is cmd O.

  • To customize the keyboard shortcut,

    Go to Setup → General → Personal Settings. Select "Motor" from the Accessibility Tab and Click "View Shortcuts" as shown in the below gif.



4. Scenario - 2

At Zylker, an international wholesale company using Zoho CRM, salespeople need a quick way to check real-time gold rates from different countries while discussing bulk orders with retailers. The solution should provide seamless access to updated, region-specific gold rates directly within the CRM interface to assist with accurate pricing decisions during customer interactions.

5. Solution

To achieve this in Zoho CRM, you need to create a Widget for EMI calculator and create a Client Script Command.

A. Create a Widget for gold rate

Install Zoho CLI, and follow the steps given in this document to create the Widget app folder. Then update the html, javascript, and css code as per your requirement.

index.html

<!DOCTYPE html>

<html>

  <head>

    <meta charset="UTF-8">

<script src="https://live.zwidgets.com/js-sdk/1.2/ZohoEmbededAppSDK.min.js"></script>

<div class="container">

      <div style="display: flex;">

        <label for="country" style="width: 70%;font-weight: bolder;">Today's Gold rate:</label>

        <select id="country" onchange="updateGoldRates()" style="width: 30%;">

            

            <option value="USD" >United States</option>

            <option value="INR" selected>India</option>

            <option value="GBP">United Kingdom</option>

            <option value="AUD">Australia</option>

        </select>

      </div>

 

      <table id="goldRatesTable">

          <thead>

              <tr>

                  <th>Type</th>

                  <th>Rate (Per Gram)</th>

              </tr>

          </thead>

          <tbody>

             

          </tbody>

      </table>

  </div>

 

  <script>

      const goldRatesData = {

     };

 

      const symbol = ['₹', '$', '£', 'A$'];

 

      async function getLiveData (currency) {

        var myHeaders = new Headers();

        myHeaders.append("x-access-token", "goldapi-4wvh4nslzb5p0d5-io");

        myHeaders.append("Content-Type", "application/json");

 

        var requestOptions = {

          method: 'GET',

          headers: myHeaders,

          redirect: 'follow'

        };

 

        let response = await fetch(`https://www.goldapi.io/api/XAU/${currency}`, requestOptions);

        let res = await response.text();

      

        let data = JSON.parse(res);

 

        let desig;

        if(data.currency === 'INR'){

          desig = symbol[0];

        }

        else if(data.currency === 'USD'){

          desig = symbol[1];

        }

        else if(data.currency === 'GBP'){

          desig = symbol[2];

        }

        else if(data.currency === 'AUD'){

          desig = symbol[3];

        }

        goldRatesData[`${data.currency}`] = [

              { type: '24K Gold', price: `${desig + " " + data.price_gram_24k}` },

              { type: '22K Gold', price: `${desig + " " + data.price_gram_22k}` },

              { type: '18K Gold', price: `${desig + " " + data.price_gram_18k}` }

            ];

 

      };

 

      async function updateGoldRates() {

          var currency = document.getElementById("country").value;

          console.log("Event:: ",currency);

          const country = document.getElementById('country').value;

          const tableBody = document.querySelector('#goldRatesTable tbody');

          tableBody.innerHTML = '';

 

          await getLiveData(currency);

          if (country && goldRatesData[country]) {

              const rates = goldRatesData[country];

              rates.forEach(rate => {

                  const row = document.createElement('tr');

                  row.innerHTML = `

                      <td>${rate.type}</td>

                      <td>${rate.price}</td>

                  `;

                  tableBody.appendChild(row);

              });

          }

      }

      updateGoldRates();

 

      ZOHO.embeddedApp.on("PageLoad",function(res){

        document.getElementById('msg').innerText = res.data;

      });

 

      ZOHO.embeddedApp.init();

    </script>

  </body>

</html>

  • Once you have added the code, upload the zip file by following the below steps.

  • Go to Setup > Developer Space > Widgets.

  • Click Create New Widget and Fill in the details.

  • The Hosting should be "Zoho" and mention the html page of the app folder that you uploaded.

 

B. Create Client Script Commands

  • Configure a Client Script Command by specifying the Name and Description and click Next. Click here to know how to configure a Client Script.

 


Script

ZDK.Client.openPopup({ api_name: 'goldrate', type: 'widget',header: undefined, animation_type: 4, 

 height: '350px', width: '300px', top:'100px',left: '500px' }, { data: 'sample data to be passed' });

  • Click here to know more about openPopup().

  • Consider that the user has created the shortcut CMD G to trigger Client Script.

  • Here is how the Gold Rate appears as and when the salesperson used the shortcut keys CMD G.


6. Summary

We have seen,

  • how to use Client Script Commands

  • how to create keyboard shortcuts for Commands

  • how to view Widget as a popup using Commands

 

7. Related Links

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner




                                                            • Sticky Posts

                                                            • Kaizen #197: Frequently Asked Questions on GraphQL APIs

                                                              🎊 Nearing 200th Kaizen Post – We want to hear from you! 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 #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.
                                                            • Celebrating 200 posts of Kaizen! Share your ideas for the milestone post

                                                              Hello Developers, We launched the Kaizen series in 2019 to share helpful content to support your Zoho CRM development journey. Staying true to its spirit—Kaizen Series: Continuous Improvement for Developer Experience—we've shared everything from FAQs
                                                            • Kaizen #193: Creating different fields in Zoho CRM through API

                                                              🎊 Nearing 200th Kaizen Post – We want to hear from you! 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.
                                                            • Client Script | Update - Introducing Commands in Client Script!

                                                              Have you ever wished you could trigger Client Script from contexts other than just the supported pages and events? Have you ever wanted to leverage the advantage of Client Script at your finger tip? Discover the power of Client Script - Commands! Commands


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

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

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Compensation | Salary Packages - Hourly Wage Needed

                                                                                                              The US Bureau of Labor Statistics says 55.7% of all workers in the US are paid by the hour. I don't know how that compares to the rest of the world, but I would think that this alone would justify the need for having an hourly-based salary package option.
                                                                                                            • How to create auto populate field based on custom module in Zoho CRM?

                                                                                                              Hello, i'm still new to Zoho CRM and work as administrator in my company. Currently, I'm configuring layout for Quotes Module. So, the idea is, I've created a read-only field in Quotes called "Spec". I want this field automatically filled with Specification
                                                                                                            • webinar registration confirmation are landing in SPMA folders

                                                                                                              I am trialing zoho webinar and do not have access to custom domains. When I test user registrations, they are working but the resulting confirmation email is landing in a spam folder. How can I avoid this?
                                                                                                            • Making digital signatures accessible to all: Introducing accessibility controls in Zoho Sign

                                                                                                              Hi there! At Zoho Sign, we are committed to building an inclusive digital experience for all our users. As part of our ongoing efforts to align with Web Content Accessibility Guidelines (WCAG), we’re updating the application with support that will go
                                                                                                            • Is there a way to set Document Owner/Sender via the API

                                                                                                              When sending requests for zoho sign, it would seem zoho uses the id of the person that created the zoho api cred to determine the owner_id, is there a way to set a default for this?
                                                                                                            • Transition Criteria Appearing on Blueprint Transitions

                                                                                                              On Monday, Sept. 8th, the Transition criteria started appearing on our Blueprints when users hover over a Transition button. See image. We contacted Zoho support because it's confusing our users (there's really no reason for them to see it), but we haven't
                                                                                                            • Delegates should be able to delete expenses

                                                                                                              I understand the data integrity of this request. It would be nice if there was a toggle switch in the Policy setting that would allow a delegate to delete expenses from their managers account. Some managers here never touch their expense reports, and
                                                                                                            • Add Save button to Expense form

                                                                                                              A save button would be very helpful on the expense form. Currently there is a Save and Close button. When we want to itemize an expense, this option would be very helpful. For example, if we have a hotel expense that also has room service, which is a
                                                                                                            • Multiple organizations under Zoho One

                                                                                                              Hello. I have a long and complicated question. I have a Zoho One account and want to set it up to serve the needs of 6 organizations under the same company. Some of the Zoho One users need to be able to work in more than 1 organization’s CRM and other
                                                                                                            • IMAP Server not responding.

                                                                                                              Trying to connect a phone via IMAP and getting "imap.zoho.com not responding." Is the server down, for maintenance or otherwise? I've tried this on two different devices and got the same error on both.
                                                                                                            • Error AS101 when adding new email alias

                                                                                                              Hi, I am trying to add apple@(mydomain).com The error AS101 is shown while I try to add the alias.
                                                                                                            • Unbundle feature for composite items

                                                                                                              We receive composite items from our vendors and sell them either individually or create other composite items out of them. So, there is a lot of bundling and unbundling involved with our composite items. Previously, this feature was supported in form
                                                                                                            • Regarding the integration of Apollo.io with Zoho crm.

                                                                                                              I have been seeing for the last 3 months that your Apollo.io beta version is available in Zoho Flow, and this application has not gone live yet. We requested this 2 months ago, but you guys said that 'we are working on it,' and when we search on Google
                                                                                                            • Open filtered deals from campaign

                                                                                                              Do you think a feature like this would be feasible? Say you are seeing campaign "XYZ" in CRM. The campaign has a related list of deals. If you want to see the related deals in a deal view, you should navigate to the Deals module, open the campaign filter,
                                                                                                            • How do you print a refund check to customer?

                                                                                                              Maybe this is a dumb question, but how does anyone print a refund check to a customer? We cant find anywhere to either just print a check and pick a customer, or where to do so from a credit note.
                                                                                                            • MTD SA in the UK

                                                                                                              Hello ID 20106048857 The Inland Revenue have confirmed that this tax account is registered as Cash Basis In Settings>Profile I have set ‘Report Basis’ as “Cash" However, I see on Zoho on Settings>Taxes>Income Tax that the ‘Tax Basis’ is marked ‘Accrual'
                                                                                                            • workflow not working in subform

                                                                                                              I have the following code in a subform which works perfectly when i use the form alone but when i use the form as a subform within another main form it does not work. I have read something about using row but i just cant seem to figure out what to change
                                                                                                            • Fetch data from another table into a form field

                                                                                                              I have spent the day trying to work this out so i thought i would use the forum for the first time. I have two forms in the same application and when a user selects a customer name from a drop down field and would like the customer number field in the
                                                                                                            • Zoho Creator as LMS and Membership Solution

                                                                                                              My client is interested in using Zoho One apps to deploy their membership academy offer. Zoho Creator was an option that came up in my research: Here are the components of the program/offer: 1. Membership portal - individual login credentials for each
                                                                                                            • Record comment filter

                                                                                                              Hi - I have a calendar app that we use to track tasks. I have the calendar view set up so that the logged in user only sees the record if they are assigned to the task. BUT there are instances when someone is @ mentioned in the record when they are not
                                                                                                            • How to View Part Inventory and Warehouse Location When Creating a Work Order in Zoho FSM

                                                                                                              Hi everyone, We’re currently setting up Zoho FSM and would like to improve how our team selects parts when creating a Work Order. Right now, when we add a part or item to a Work Order, we can select it from our Zoho Inventory list but we don’t see any
                                                                                                            • FSM too slow today !!

                                                                                                              Anybody else with problem today to loading FSM (WO, AP etc.)?
                                                                                                            • CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive

                                                                                                              Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
                                                                                                            • Not able to Sign In in Zoho OneAuth in Windows 10

                                                                                                              I recently reset my Windows 10 system, after the reset when I downloaded the OAuth app and tried to Sign In It threw an error at me. Error: Token Fetch Error. Message: Object Reference not set to an instance of an object I have attached the screenshot
                                                                                                            • Mapping a custom preferred date field in the estimate with the native field in the workorder

                                                                                                              Hi Zoho, I created a field in the estimate : "Preferred Date 1", to give the ability to my support agent to add a preferred date while viewing the client's estimate. However, in the conversion mapping (Estimate to Workorder), I'm unable to map my custom
                                                                                                            • Runing RPA Agents on Headless Windows 11 Machines

                                                                                                              Has anyone tried this? Anything to be aware of regarding screen resolution?
                                                                                                            • The sending IP (136.143.188.15) is listed on spamrl.com as a source of spam.

                                                                                                              Hi, it just two day when i am using zoho mail for my business domain, today i was sending email and found that message "The sending IP (136.143.188.15) is listed on https://spamrl.com as a source of spam" I hope to know how this will affect the delivery
                                                                                                            • Delegates - Access to approved reports

                                                                                                              We realized that delegates do not have access to reports after they are approved. Many users ask questions of their delegates about past expense reports and the delegates can't see this information. Please allow delegates see all expense report activity,
                                                                                                            • Split functionality - Admins need ability to do this

                                                                                                              Admins should be able to split an expense at any point of the process prior to approval. The split is very helpful for our account coding, but to have to go back to a user and ask them to split an invoice that they simply want paid is a bit of an in
                                                                                                            • What is a a valid JavaScript Domain URI when creating a client-based application using the Zoho API console?

                                                                                                              No idea what this is. Can't see what it is explained anywhere.
                                                                                                            • Is there a way to request a password?

                                                                                                              We add customers info into the vaults and I wanted to see if we could do some sort of "file request" like how dropbox offers with files. It would be awesome if a customer could go to a link and input a "title, username, password, url" all securely and it then shows up in our team vault or something. Not sure if that is safe, but it's the best I can think of to be semi scalable and obviously better than sending emails. I am open to another idea, just thought this would be a great feature.  Thanks,
                                                                                                            • Single Task Report

                                                                                                              I'd like a report or a way to print to PDF the task detail page. I'd like at least the Task Information section but I'd also like to see the Activity Stream, Status Timeline and Comments. I'd like to export the record and save it as a PDF. I'd like the
                                                                                                            • Auto-response for closed tickets

                                                                                                              Hi, We sometimes have users that (presumably) search their email inbox for the last correspondence with us and just hit reply - even if it's a 6 month old ticket... - this then re-opens the 6 month old ticket because of the ticket number in the email's subject. Yes, it's easy to 'Split as new Ticket', but I'd like something automated to respond to the user saying "this ticket has already been resolved and closed, please submit a new ticket". What's the best way to achieve this? Thanks, Ed
                                                                                                            • How to Push Zoho Desk time logged to Zoho Projects?

                                                                                                              I am on the last leg of my journey of finally automating time tracking, payments, and invoicing for my minutes based contact center company - I just have one final step to solve - I need time logged in zoho desk to add time a project which is associated
                                                                                                            • Cannot access KB within Help Center

                                                                                                              Im working with my boss to customize our knowledge base, but for some reason I can see the KB tab, and see the KB categories, but I cannot access the articles within the KB. We have been troubleshooting for weeks, and we have all permissions set up, customers
                                                                                                            • Export to excel stored amounts as text instead of numbers or accounting

                                                                                                              Good Afternoon, We have a quarterly billing report that we generate from our Requests. It exports to excel. However if we need to add a formula (something as simple as a sum of the column), it doesn't read the dollar amounts because the export stores
                                                                                                            • why my account is private?

                                                                                                              when i post on zohodesk see only agent only
                                                                                                            • Getting ZOHO Invoice certified in Portugal?

                                                                                                              Hello, We are ZOHO partners in Portugal and here, all the invoice software has to be certified by the government and ZOHO Invoice still isn´t certified. Any plans? Btw, we can help on this process, since we have a client that knows how to get the software certified. Thank you.
                                                                                                            • Show/ hide specific field based on user

                                                                                                              Can someone please help me with a client script to achieve the following? I've already tried a couple of different scripts I've found on here (updating to match my details etc...) but none of them seem to work. No errors flagged in the codes, it just
                                                                                                            • 500 Internal Server Error

                                                                                                              I have been trying to create my first app in Creator, but have been getting the 500: Internal Server Error. When I used the Create New Application link, it gave me the error after naming the application. After logging out, and back in, the application that I created was in the list, but when I try to open it to start creating my app, it gives me the 500: Internal Server Error. Please help! Also, I tried making my named app public, but I even get the error when trying to do that.
                                                                                                            • Next Page