Client Script for tags

Client Script for tags



Hello everyone!

Welcome to another informative Kaizen post. In this post, let us see how to accomplish the following using Client Script.

1.  How to auto-tag a record based on field update?

2. How to Open a pre-filled email draft 

This post will provide a quicker solution using Client Script for the queries mentioned in the posts Is it possible to auto fill email draft? and How to tag quickly?

In this Kaizen post,



  1. Tags in Zoho CRM
  2. ZDK functions related to Tags
  3. Use Case 
  4. Solution
  5. Summary
  6. Related Links



1. Tags in Zoho CRM

Tags in Zoho CRM are not just a simple category; they can be more powerful since you can add multiple tags to a single record. You can also create tags in multiple locations in your CRM account, if required. Click here to know more about working with tags.
2. ZDK Functions related to Tags

Below are the ZDK Client APIs supported by Client Script related to tags. Click here to view the documentation.
  • addTag()  - Add a tag/tags to a record
  • removeTag() - Remove a tag/tags to a record
  • getTags() - Get the list of all tags of a record

Notes
Note :
 These ZDKs can be used only for Detail Page(Canvas) and Detail Page(Standard)

Apart from these, you can use the below ZDK CRM APIs to add and remove tags.
  • addTagsToRecord()         - Add Tags to Record
  • addTagsToRecords()       - Add Tags to Record
  • removeTagsToRecord()  -  Remove Tags from Record
  • removeTagsToRecords() - Remove Tags from Records

Notes
Note
The above ZDKs implicitly invoke the Add tags API and Remove tags API. Click here for more details.The execution of the above ZDKs will impact your API credits

To know more about Client Script's ZDKs to implicitly invoke CRM APIs, check this kaizen post. The event onTagChanged - This event occurs on the click of save button of Add tags.

3. Use Case 

Quote
At Zylker, the manager seeks to optimize the handling of order complaints by automating the tagging and notification process. When a customer support agent who places an order on behalf of customers also logs a complaint in the "Order Issue" field of the Orders module, then the order should automatically be tagged as "Issue Reported." This action should open an email draft, pre-filled with a specific template , along with the "To," "From," and "Subject" fields automatically populated after getting confirmation from the customer support agent, and notify the delivery team to check and resolve the issue.

4. Solution

For the above requirement, you need to create a Client Script that triggers when the customer support agent updates the Order issue field.
  • Configure a Client Script for Detail Page(Standard) Orders module, that triggers during onBeforeUpdate Event of Type Field event of Order Issue, as shown below and click Next



  • Click here to know how to configure a Client Script.
  • Enter the following script in the IDE and click Save.

  1. if (value != null) {
  2.    ZDK.Page.addTag('Issue Reported');
  3.    ZDK.Client.showConfirmation('The Tag *Issue Reported* has been added successfully.    Do you want to notify support team?', 'Yes', 'No');
  4.     ZDK.Client.openMailer({ from: 'support@zylker.com', to: [{ email: 'zylker@zyldomain.com', label: 'zylker@zyldomain.com' }], cc: [{ email: 'info@zyldomain.com', label: 'info@zyldomain.com' }], subject: 'Issue Reported', body: '', templateId: "4967860000006521006" });
  5. }
  • In the above script, whenever the customer support agent updates comments in this field, a new tag gets added by ZDK.Page.addTag(). Here is the syntax:


  • Once the tag gets added, a message gets displayed using the ZDK.client.showConfirmation(). The message mentioned in the confirmation box supports markdown. Based on confirmation, the mail draft opens using ZDK.Client.openMailer(). Here is the syntax:


  • Here, you need to specify the template ID of the email in the openMailer() ZDK along with the other details like from, to , cc. 
  • To get the template ID, go to setup-->templates-->select the template that you want and click edit.
  • You can pick the template ID from the URL.


  • Click here to know more about email templates. Here is how the Client Script works.


    Summary

    In this post, we have seen
  • How to add a tag automatically to a record when a Detail Page is updated.
  • How to fetch the tags associated with a record using Client Script.
  • How to open pre-filled email draft from Detail Page(Standard)
  • How to fetch the template id of an email

Related Links: 

Let us know your thoughts in the comment section or reach out to us at support@zohocrm.com. Stay tuned for more insights in our upcoming Kaizen posts!


Happy Client Scripting!


    • Recent Topics

    • Publish directly to production

      Hello! I am wondering if there is a way to publish changes directly to the production version of an application?
    • default reply email

      In the zoho mail application you can make another email your default email address.  So when you compose a new email it defaults to the email address you have set.  However this functionality does not work when you reply to an email.  you can select the email from a drop down, but I wanted to know if their is a way to set the reply email button as a different default email, just like the compose functionality.  An example:  I write an email from my zoho email account to a client witch show the sender
    • Give Permission for User test in Development/Staging modes

      Hi Everyone, I am using Zoho Creator C6. Where there are development and staging modes. Is it possible to give special / temporary permission for users to test directly in development and staging? Or do you have any other ideas? Thank you very much.
    • Autotranslate only have 2 of my 3 languages

      My HelpCenter has three languages, as you can see below: I chose to use Google Translate for my automatic translations: I can only see 2 languages: How do I add the Portuguese here? Is this a bug? Thank you.
    • Planned, actual and forecast hours

      Hi there, I'm attempting to use Zoho to plan projects and time, but it's so confusing. I have two questions: Why, in the screen shot below, is my planned hours saying 8? I have assigned 8 work hours to the task, and I have logged 4 hours of actuals. I
    • RingCentral Intergration Fax

      Hello Zoho Community , I recently intergrated with ring central with zoho crm. Ring central is a fully loaded buisness VOIP and Fax system , however I think there should be a button in Zoho to allow users to fax out the same way users are able to fax out on the ring central web application.  Myself and many other users are industries that communicate through fax. Its such a burden to have to download pdf and then send manually. If possible an activiity log built in to the module as well would be
    • Import CRM Vendor Module for Mail Merge

      Hello, It seems I cannot import the vendor module field for a merge document? Is there a way to turn this on?  I have the ability to import my custom module fields, but not standard built-in CRM modules like Vendors.  Am I missing something? Thank you very much for your assistance!
    • Custom Function : Copy multilookup field to text field

      Hi, I'm a newbie on function programming, I try to copy text from a multi lookup field named "societe" to a text field named "societe2". I've used this code. In deluge script it seems to work, but when I trigger this function it doesn't work (Societe2
    • Merging 2 tickets

      Hi I understand how to merge 2 tickets already but find the process quite cumbersome. It is not always simple to perform a search that causes the 2 tickets in question to show up on the Ticket Screen, and this is the only place a merge can be performed. Doing a search for the customer or contact linked to the ticket displays all of their tickets which could be hundreds to sort through, you could do a custom search that only shows open tickets but doing that every time is also time consuming. Not
    • Client Script event on any field of a Detail page

      Hi everyone! I'd like to trigger a Client Script when a user modifies a field - any field - from the Account Details page, how can I do this? I don't want to trigger it on a specific field, but on all of them. Thanks in advance!
    • Allow SO Item table to search other fields in items to make entry easier

      We have thousands of items, some of which need to be entered on the fly by desk people. We don't want abstracts like the vendor's part number in our SKU or Item name. It would make order entry much easier if the context search in the items table would
    • How Do I Refund a Customer Directly to Their Credit Card?

      Hi, I use books to auto-charge my customers credit card. But when I create a credit note there doesn't seem to be a way to directly refund the amount back to their credit card. Is the only way to refund a credit note by doing it "offline" - or manually-
    • Can’t Send Outgoing Mail

      Hello, one of the email addresses on my account had its outgoing mail privileges blocked. This was due to some bot signups on my website, causing my email to send a bunch of undeliverable emails. I have corrected this issue on my website. Please restore
    • zoho webmail keeps opening an empty tab when on log in/vist webmail

      as the the title says, whenever i log in or visit the page in a new tab, zoho webmail with open a new tab, but it errors out (see attachment). how do you stop it from doing this?
    • Sending possible. Receiving not possible.

      We are not receiving mail in our company email. Could you please solve this. It has been recurring and I want it to be resolved once and for all. Please help.
    • Efficient way to get a list of records like Notes under Leads that changed in last N minutes

      Hi, I am writing a process to consume the Zoho Leads and put it in an internal system. For Leads, Accounts and Contacts, the getRepords with lastModifiedTime works great as I can call the API to get only the updated records say in last 30 minutes. However
    • IMAP Connection Issue – "Disconnect called before connection setup" (Zoho + Freshdesk Integration)

      Hello, Since April 25, 2025, we are facing a critical issue with our Zoho Mail integration with Freshdesk. Incoming emails are no longer being received in Freshdesk. Freshdesk Support has confirmed that their system is trying to connect to our Zoho mailbox,
    • Fetching a missing Folder, now creates it

      Hello, I'm using Zoho Flow to fetch a folder within a Team Folder. If the folder is missing (folder ID is null), I trigger a Create Folder. Now in 2025, when I fetch a missing folder, a folder is created right away with the "name + full date" and a Folder
    • Is the "schedule 10 mass emails/module" limit a per user or per organization limit?

      For scheduling emails out of Zoho CRM, there is a 10 scheduled mass emails per module limit according to Zoho documentation (https://help.zoho.com/portal/en/kb/crm/faqs/emails/articles/how-to-schedule-mass-emails-in-zoho-crm). Is this limit per user or
    • How Would I get data from a network drive to be feed into creator program.

      What's the easiest and cleanest solution for this?
    • Using Zoho One to manage two (or more) businesses

      We are one company that operates two business, a scenario that Zoho One doesn't really seem to handle very well, and one which I can't imagine is at all unique to us! (It is basically designed to facilitate branding and use for one business only per subscription).
    • Cannnot find criteria tab

      We need to be able to segment contacts based on an account view or field. The online help shows a screen with three options: Under Sync Details there is All Contacts; Custom view; Criteria.  The latter is missing from my screen.  I need it. I also want to know if I delete contacts from campaigns, will they still remain in CRM? 
    • Dial Charts in Analytics using field values for colored ranges

      Hey all! It would be supremely helpful if we could use field values for ranges in Analytics for dial charts. We currently display an analytics report to our sales team showing how close they are to reaching the next tier for commission payouts. We update
    • A couple of minor enhancements to Workflows

      Last updated on September 17, 2024: These enhancements were initially available for early access, and we've now enabled them for all users. We are elated to announce a couple of enhancements to custom functions in our Workflows! Say hello to: "Source"
    • South Africa Tax Edition is now Available!

      Managing taxes just got easier for field service businesses in South Africa! With Zoho FSM's new South Africa tax edition, field service businesses operating in South Africa can now effortlessly stay compliant with local tax regulations. Easily manage
    • How to overcome Zoho Deluge's time limit?

      I have built a function according to the following scheme: pages = {1,2,3,4,5,6,7,8,9,10}; for each page in pages { entriesPerPage = zoho.crm.getRecords("Accounts",page,200); for each entry in entriesPerPage { … } } Unfortunately, we have too many entries
    • Introducing ICR in Zoho CRM: Transform your printed text into digital data

      From writing on papyrus in the ancient times to creating a humble record in your CRM, the world may have evolved with how it used to record data, but data entry as such has not been simplified. It is still a repetitive and arduous chore on which businesses
    • How to Add Custom Sections in the Product Page?

      Hi Zoho team, I’m currently using the Tranquil theme on Zoho Commerce and I have a question regarding the product page layout. Right now, under each product, I can see expandable sections like Product Details and Specifications. I’d like to add two additional
    • Bulk user onboarding for Cliq Channels in a jiffy

      As developers, we frequently switch between coding, debugging, and optimizing tasks. The last thing we want is to be burdened by manual user management. Adding users one by one to a channel is tedious and prone to errors, taking up more time than we could
    • Weekly Tips: Secure your attachment downloads with Zoho Mail

      Safety is one of our main concerns, whether it’s about device security or online protection. We use tools like fingerprint scanners, facial recognition, and two-factor authentication to keep our devices and email accounts secure. We use methods like OTP
    • Issues with Dashboard Filter and KPI in Zoho Analytics (CAGR)

      Hi everyone, I'm trying to build a CAGR (Compound Annual Growth Rate) KPI in Zoho Analytics, but I'm running into some issues with filter synchronization. Here's the scenario: I created two test reports: One that filters results from 2021 to 2025. Another
    • Adding Product Photos through Import or In Bulk

      I am about to add about 1000 products in the CRM. I am shocked that there is no way to add product photos through the Import feature. I'll be spending days adding product photos.... Very dissapointing. Anyone know of a work around to add product photos
    • Announcing Multi-language Support in Zoho FSM

      Zoho FSM now speaks your language. The much-awaited multi-language support is now available in Zoho FSM. The following languages are supported in Zoho FSM: Dutch (Nederlands) English - United Kingdom English - United States French (français) French -
    • How to sync Zoho CRM Quotes with Zoho Books/Finance Estimates or Quotes

      Hi everyone, We’re building quotes in the Zoho CRM Quotes module because of its strong CPQ features and better communication options (multiple contacts, email customization, etc.). However, these don’t sync directly with Zoho Books/Finance for invoicing.
    • Quiz of the Day on Dashboard

      Hi team, Is it possible to enter a feature for enabling a widget as a quiz for the day. This widget can have one question popping up daily from the list of some pre-fed questions and the employees need to either type a response or can select from a multiple-choice
    • Email content strategy

      This is basically a couple of questions about the best practices when it comes to the use of colors as part of the message sent through the email campaign. 1 - Is there a guide or recommendation as to what are the best colors for text/background associated
    • Canvas Button Vanished

      I have a button that has mysteriously vanished. It shows in the canvas builder but then is no where to be found in the actual record and before you ask, yes I have tried to access through incognito mode and same issue.
    • Multiple Tabs in the Dashboard

      Hi team, Can we enable an option to add multiple tabs in a dashboard? This will help to group the content to be displayed to employees and make it more usable and user-friendly intranet space.
    • In the Pivot table in the value section i want to the actual value instead of sum or count

      I am creating Early/late Check and check out in pivot report based on Zoho analytics I need the data to include: Employee Name Late Entry, Early Entry, Early Exit, Late Exit, First In, Last Out, and Total Hours.
    • Introducing Assemblies and Kits in Zoho Inventory

      Hello customers, We’re excited to share a major revamp to Zoho Inventory that brings both clarity and flexibility to your inventory management experience! Presenting Assemblies and Kits We’re thrilled to introduce Assemblies and Kits, which replaces the
    • Next Page