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!


    Nederlandse Hulpbronnen


      • Recent Topics

      • Custom CSS in Zoho Form

        Hi, Please let me know, how we can add custom css in Zoho Form.  Thanks
      • Deluge Script to Reopen Ticket if Tasks are not Completed

        I have the following script, my goal is to have it automatically reopen the ticket when the ticket is closed if there are Activities assigned to the ticket that are not "Completed". This script seems to reopen the ticket if there are any tasks at all,
      • Zoho Desk & Tasks

        Hi, I'd like to be able to create a set of tasks each time a customer request comes in, as I understand it, currently each would need to be create manually. Project is too much of an overhead for what we want to use. Effectively in various use cases we
      • Export all Zoho desk tickets for past 3 months

        Hi I need to export ticket data from Zoho Desk. Specifically, I'm looking to: Export the last 3 months of tickets⁠ include ticket categories, timestamps, resolutions, agent responses (basically as much data as possible) the ticket content being the most
      • Zoho CRM <> Zoho Desk Account Sync

        I have had custom fields in Zoho CRM for a time and would like that data to sync to Zoho Desk. However, since the accounts are all synced to Zoho Desk already, the newly mapped fields are not updating in Zoho Desk. Is there a way to force the sync to
      • Count Function in Zoho Table

        Hi Zoho Team, Hope you're doing well. We would like to request the addition of a Count function in Zoho Table, similar to what exists in Excel, Google Sheets, and Airtable. Currently, there is no built-in way to count the occurrences of unique values
      • Configuring ZMA Webhook for Zoho Flow : Missing Key Information Error

        I'm looking to send a webhook to Zoho Flow at the end of a Marketing Automation journey in order to perform more actions that I can't do with just a journey. I have the Webhook created in Flow and set up in ZMA, however when I test it I get the error
      • Zoho Billing Record Refund vs Refund

        When looking at a paid invoice, the payment record can be viewed. In the more actions, there is a "Record Refund" option. If you click the payment referernce you see a "Refund" option. They bring up different forms. It appears as if "Record Refund" is
      • Emoticons to Slack in Zoho Flow

        When using the Slack integration in Zoho Flow, is there a way to send emoticons in the message? When I tried :emoticon: it didn't translate it to the emoticon.
      • Unified WhatsApp Number Management in Zoho Desk and SalesIQ

        Dear Zoho Desk Support Team, We are currently utilizing both Zoho Desk and Zoho SalesIQ for our customer support operations. While both platforms offer WhatsApp integration, we are facing challenges due to the requirement of separate WhatsApp numbers
      • Set connection link name from variable in invokeurl

        Hi, guys. How to set in parameter "connection" a variable, instead of a string. connectionLinkName = manager.get('connectionLinkName').toString(); response = invokeurl [ url :"https://www.googleapis.com/calendar/v3/freeBusy" type :POST parameters:requestParams.toString()
      • How to set default filter to CRM integration field

        I have a products subform in my order form and I'm using the CRM integration field to connect the Products module from my CRM to this subform. I want to filter the data that is fetched to the field from the CRM based on a status field in the Products
      • Restore Report in Zoho Creator After Changing Report Type

        I created a report in Zoho Creator and have been using it regularly. While editing, I accidentally changed the report type, and all the fields disappeared from the report. I am using the development version, but I don’t want to revert all the changes
      • Zoho Creator Upcoming Updates - March 2025

        Hello everyone, We hope you’ve had the chance to explore Release Projection 1 for 2025! This month, we’re keeping up the momentum by bringing even more powerful features and enhancements to Zoho Creator. Here's what you can expect in March: App menu builder
      • Why can't you make a layout rule based on a lookup field?

        Hello :) I am wanting to build a layout rule based on the selection of a lookup field. I have 3 fields that I want to hide for all options, but only show one if the lookup is one of the 3 options needing the extra field. It doesn't seem to give me the
      • Client Script | Update - Introducing Subform Events and Actions

        Are you making the most of your subforms in Zoho CRM? Do you wish you could automate subform interactions and enhance user experience effortlessly? What if you had Client APIs and events specifically designed for subforms? We are thrilled to introduce
      • How to associate a document sent in Zoho Sign with an deal in the CRM?

        Hi, often documents are loaded in Zoho sign and sent for signature. These sometimes are linked to a deal in the Zoho CRM and would be nice to see the status of the document within the CRM. I am aware of the integration, but that assumes that the document
      • Why Sharing Rules do Not support relative date comparison???

        I am creating a Sharing Rule and simply want to share where "Last Day of Coverage" (Date field) is Greater than TODAY (Starting Tomorrow). However, sharing rules don't have the option to compare a date field to a relative date (like today), only to Static
      • How to add "Forever Free Plan" to existing mail lite plan?

        There's an offer for: "Up to five users, 5GB/User, 25MB attachment limit." I already have a mail lite plan. I really like zoho mail and would like this added but I can't seem to access it. Keeps redirecting me to my existing inbox when i click the o
      • 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
      • i can't create other user with my lite plan

        hello, I have paid little plan and I have added two domains but each has its own user however zoho shows me this message You do not have enough licenses. Purchase the necessary licenses to add, invite or import users I don’t know why if I have another
      • Zoho Books & Zoho CRM - Funcionalidade do campo moeda

        Pessoal bom dia, O Zoho Books tem uma funcionalidade nos campos de moeda, que ao colar números decimais com vírgula ( , ), ele automaticamente transforma para o formato de ponto ( . ). Ex: R$ 2,50 --> R$ 2.50 Esse comportamento está disponível no Zoho
      • Does Mail Lite allow SMTP?

        I am looking to use SMTP access, however I am not sure what plan I have to purchase, please assist.
      • No image image comes out in the recipient when I sent an email

        Hello to the entire forum, when I send an email from Zoho, my profile picture does not come out. On the other hand, if you do, using Gmail accounts. How is it configured to leave ??? Thank you Greetings !!
      • Iphone receipt capture stopped working

        I have been having difficulty getting receipt capture to work on the iPhone app. I have been using a work around by taking a photo with my camera then uploading it into the app instead of taking the picture through the app. This adds way too much extra
      • cant receive emails

        I have checked the Dns and everything seems to be fine pls check the print screens attached below help me cause i need to solve this fast
      • Create View to See Tickets Closed within the last 3 days

        I'm trying to create a view in Zoho Desk that shows me "recently closed ticket," which I will define as tickets closed in the last 3 days. I want this view to update so that whenever I click to view it is recalculates and shows me tickets closed within 3 days from that moment. When I try to Create a view and use the criteria of "Ticket Closed Time" I have to specify a discrete time frame (on or before a specific date). It doesn't allow me to define time/date dynamically like I can do with date fields
      • ERROR 554 5.1.8 Sender Address Blocked code(554)

        We have an email with Zoho ( comercial@bruiser.com.br), but, when we try associate the account in GMAIL, the server shows this message:  554 5.1.8 Sender Address Blocked code(554) I see this error appear when the limits of returns exceded 10 messages,
      • Unable to send message;Reason:550 5.4.6 Unusual sending activity detected. Please try after sometime

        Hello i'm unable to send any email because i keep getting this error Unable to send message;Reason:550 5.4.6 Unusual sending activity detected. Please try after sometime i have literally sent less than 10 emails today i'm not sure why i'm getting this
      • IP Addresses for Whitelist

        Hi,  Where can I get a list of the IP addresses I need to whitelist for accessing Zoho Desk? TIA
      • Recording overpayment?

        So a customer just overpaid me and how do I record this? I can't enter an amount that is higher than the invoice amount. Eg. Invoice is $195 and he sent $200. He's a reccuring customer so is there a way to record so that he has a $5 advance for future invoice?
      • Rejected Accounts still listed for Deal

        Hello guys I have a approval process thats validate the Accounts in CRM The issue is even when a account is rejected you can open a deal with it It's not supposed to appear in the lookup field or the approval process become pointless Can you guys help
      • Zoho Rentals

        Team, Zoho Inventory provides great features for Retail Sales and Purchases. On a similar note, There are significant portion of Rental industry would be missed out, if not looked into. Can we have a Zoho Rentals which can integrate with Zoho Inventory? Thanks!
      • zet pack not working

        We are using the zet pack command to package our Zoho extension. However, after running the command, the extension gets packed, but the resulting package is empty. We've attached a screenshot for reference. Could you please assist us with resolving this
      • How can I view Help Center articles in 'Sandbox' mode?

        I have published some help center articles but when I try to preview the knowledge base page, it says 'We have no content to display'.
      • Zoho Books API down

        We've been using the zoho books api for the last few weeks to pull open invoices, and the code has stopped working suddenly. When making the same API call as always, we're getting a 400 error.
      • Loop in Blueprint but it works. Why? How should this be set?

        see picture
      • Introducing Keyboard Shortcuts for Zoho CRM

        Dear Customers, We're happy to introduce keyboard shortcuts for Zoho CRM features! Until now, you might have been navigating to modules manually using the mouse, and at times, it could be tedious, especially when you had to search for specific modules
      • POS System

        Has anyone had any luck integrating a POS system with the zoho crm? Any advice where to look for a zoho proven solution? Thanks in advance.
      • Reporting tag as mandatory

        Why we can't set it as mandatory once we need to input it to get the budget affect?  
      • Next Page