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

    • Stock count by bin location

      Is there a configuration to make a stock count by bin or area and not by product. these is useful to manage count by area Regards
    • 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
    • Best website platform to sync to Zoho Inventory

      Anyone like to suggest the best website platform for syncing to Zoho Inventory? We DO NOT want to sync stock, only orders. Shopify - not an option as we have more than one website and Shopify requires 2 accounts and Zoho will not sync with 2 different accounts. Magento and WooCommerce both sync via Kloudconnectors - does anyone have any experience with this? I have trialled it and there are flaws - eg purchase order numbers are not populated. Discussion welcome!
    • Convert Item to composite item

      When using Zoho CRM integrated with Zoho Inventory/Books, the item creation process is a little messy. After a few years of trial and error, we have settled on creating items in CRM, which are sync'ed to Zoho Inventory using Zoho's own internal integration.
    • Include product images in data sync between Zoho CRM and Zoho Inventory

      Currently the item image does not sync between Zoho CRM and Zoho Inventory when using the internal Zoho sync functionality. This requires users to manually update the item image in Zoho Inventory for products created in CRM and vice versa. Including the
    • Zoho Inventory Item History

      Hi Zoho Inventory Team, I 've been testing the History feature on Inventory Items in a demo system and I noticed that when I changed the value of a field to a new value, the history just says "updated by - user1", it doesn't say what what field was changed
    • Show ordered quantity on packing slips and invoices

      Hello Is there any way possible to show the original ordered quantity of an item (as recorded in the sales order) on subsequent package slips and sales invoices, so that these documents can show the customer the ordered qty vs the qty being currently
    • Search Zoho Inventory Items module via API

      How can I search Zoho Inventory Items by custom fields, categories, etc using the API? This is not documented. Is there an advanced search function like CRM's COQL search available via the Zoho API? If there is an undocumented way to search Items via
    • How can I get my images to display correctly on mobile site?

      I have just created a site and uploaded images, which look perfect on the desktop version. However when I view the site on my mobile device some of the images are not displaying correctly. They are all blurry. Anyone else experience this?
    • Does Creator support HTMX?

      I love the Zoho ecosystem and Zoho Creator does a lot of things really well. However, I'm needing more real-time interactivity in my forms. Is the only option to create a JS widget? How about HTMX?
    • My fix for "This report is not accessible" in published pages

      Hi Community, after having the same issue as many others here and going through the community's posts, i found a solution on my own. Again, the quality of support from Zoho is pretty awful: if you cannot help yourself, you're lost. I really like Zoho,
    • Tip of the Week #59– Enhance team collaboration with multichannel shared inboxes!

      Struggling with scattered customer conversations and missed follow-ups across your team? When messages are everywhere, it's easy for them to fall through the cracks—leading to delays, duplicate replies, and miscommunication among team members. Zoho TeamInbox
    • Subforms in stateless forms

      I think the title says it all. We need to be able to add subforms to stateless forms. Currently the only workaround is to create a Form and delete each record upon submission of the form. I need to build an interface to update our inventory. Basically
    • Delete standard e-mailtemplate

      Hello, Is it possible to delete or hide a standard e-mailtemplate? I would only like to show my own created e-mailtemplates to my staff. I only find a 'delete' option at my custom made e-mailtemplates, but the standard e-mailtemplates do not show this
    • Shuffling between one note to the next

      I usually start all my notes per interaction with a contact with the date and then a little detail.  But when I search for it it only see a small portion of the note and can't immediately tell which contact its associated with. can we make the note content column wider to fit more information and please have a column header that says which contact its associated with.
    • CRM notes

      I want to be able to add notes to a task that do not necessarily get rolled up into an account or contact.   For example, I tasks to work on a Court Order for John Doe divorce account.  There might be lots of updates (in the form of notes) that employees
    • Add values to Countdown Mode

      Is it possible to add values to the countdown mode drop down? The longest is 2 days. I would like values for 5 days, 10 days, 15 days...
    • RSS feed from a Zoho site blog?

      Does the Zoho Site blog have an RSS feed associated with it? I would like to have this picked up on a business Facebook page. thanks
    • Refresh token not appearing

      Hello, I was wondering if there is another way of obtaining a refresh token, as following the usual 60-second-code procedure generates a new access token, but not the refresh token, and so i have to repeat everything to get a new token every hour or so,
    • How would I collect a signature in person on Zoho sign?

      Suppose I have a customer show up at my office and we close a deal. I have an iPad ready to go, and I need to have the customer sign the document right there. How would I do it?
    • What's New in Zoho Analytics - June 2025

      Hello Users, We're delighted to bring you new features and enhancements designed to make your analytics experience smarter and more powerful than ever. AutoML Enhancements We’re thrilled to introduce powerful new AutoML enhancements, making machine learning
    • Zoho Books | Product updates | June 2025

      Hello Users, We’ve rolled out new features and enhancements in Zoho Books, from the option to record advances for purchase orders to dynamic lookup fields, all designed to help you stay on top of your finances with ease. Introducing Change Comparators
    • Creator roadmap for the rest of 2022

      Hi everyone, Hope you're all good! Thanks for continuing to make this community engaging and informative. Today we'd like to share with you our plans for the near future of Creator. We always strive to strike a good balance of features and enhancements
    • CRM Client scripts via extension?

      I've made a lot of industry specific customization to zoho CRM, using custom modules, workflows/automations, deluge scripts, api calls, and client scripting. I have had organic interest explaining what i've done to other small business owners in my industry.
    • How to import data via Excel for a multi-select lookup field?

      In the Accounts module, I have a multi-select lookup field to the Contacts module. When I import Accounts data via Excel, I want to enter the contact email address (which is used as the identifier) under the column name for the multi-select lookup field.
    • Tracking Emails sent through Outlook

      All of our sales team have their Outlook 365 accounts setup with IMAP integration. We're trying to track their email activity that occurs outside the CRM. I can see the email exchanges between the sales people and the clients in the contact module. But
    • Customized folder permissions in web Zoho WorkDrive won't apply to Sync

      Hi, within the 'Deals' macro-folder I created a folder for each Sales person (att. 1). Within each Sales person's folder a subfolder is automatically generated via function every time a new deal record is created in Zoho CRM, i.e. 1 deal record = 1 deal
    • Zoho.eu and U.S. Cloud Act? Can U.S. request Zoho.eu data?

      Given the current political situation in the U.S. and possible near future implications for data privacy and security, I am curious about Zoho’s obligation to comply with the U.S. cloud act or other U.S. requests for private customer information from
    • Zoho Sheet - Desktop App or Offline

      Since Zoho Docs is now available as a desktop app and offline, when is a realistic ETA for Sheet to have the same functionality?I am surprised this was not laucned at the same time as Docs.
    • GSTIN Public Search API

      Does zohobooks have an api using which i can search GST numbers and get their details?
    • What happens after trial period

      Dear Support, We are planning to use ZOHO CRM for our organization. We are now registered for a 15 days trial version. I would like to know what happens with our account and our data after these 15 days. Will it automatically change into a 'free' account
    • Forte's Extra Costs

      Hello everyone in the Zoho community, I wanted to share some information about Forte in case anyone wanted to look into them as a processor.  I currently use Stripe, but wanted to use Forte's ACH to pay vendors and take ACH payments for our products.  This is one of the only ACH processors that Zoho accepts. They state their cost is $25/month plus their transaction fees for ACH.  However, after signing up and going through their approval process, I found this out they work with a PCI compliance service
    • SEPA stripe vs gocardless

      Hi, we want to use Zoho Books - but as we are a company that is based in Germany we are using SEPA mandates. I know that its possible to use GoCardless - but the fees are extremly high (15 EUR fee for a 5000 EUR transaction). Is there any other way to
    • Zoho Commerce - Zoho Shop (Multilanguage)

      hi there we have a shop in zoho commerce, can I change the language in the shop, i mean, can I create a German and a French version, as an instance or something? If yes, how it works? thanks for your answers greetings prisca
    • French Tutorials

      Is there any Zoho projects tutorials, ebook, video or else in french? If so, where can I fin it please? Thx
    • My zoho mail has been disabled and cannot send email

      I’m the super admin for my company’s email accounts, but my own email address has been unexpectedly locked. I’m seeing the following error message: Could you please assist in unlocking my account so I can resume sending emails?
    • Update Lead Status in Zoho CRM When a Meeting is Booked via Microsoft Bookings

      Hi everyone, I’m trying to streamline our lead management process and would like to automatically update the Lead Status in Zoho CRM whenever a meeting is booked through Microsoft Bookings. Has anyone successfully implemented this kind of integration
    • SMTP error

      I am using SMTP from Zoho the account is accounts@khlaklaeeb.com it was working fine then started to have Error and unable to delivery messages SMTP host SMTP.zoho,com SMTP user: accounts@khlaklaeeb.com SMTP port 465 PAssword: App Password it was working
    • Zoho Books Roadshows are back in the UAE!

      Hello there, Business owners and accounting professionals of the UAE, we’re coming to your cities! FTA accredited Zoho Books is now officially one of the Digital Tax Integrators in the UAE. With the newly launched direct VAT filing capabilities, we're
    • Automatically creating a ticket in Zoho Desk when an invoice is created in Zoho Books

      I need to find a way to create a ticket automatically (i.e. using workflow) in Zoho Desk whenever an invoice is created in Zoho Books. Please advise if there is a way of doing that?
    • Next Page