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

        • compensation module - salary - No decimals allowed regardless of currency

          In the United Kingdom we have calculations in GBP which has figures to 2 decimal points. When using either the basic salary or using the CTC with benefits etc. It will block any upload or entry which is not a round number! I have advised Zoho One and
        • Tip of the Week #56 – Analyze performance with analytics reports.

          Wondering how well your team is managing communications in shared inboxes? It’s time to stop guessing and start knowing — with Analytics Reports! As an admin, you get a broader view of your team's performance by tracking important metrics such as response
        • Zoho Sprints is now AI empowered

          Enhance the quality of your work with the power of generative AI tools in Zoho Sprints. These tools help you write precise descriptions, summarize content, analyze sentiment and tone, and translate content into your preferred language, and write and explain
        • If Formula with Abs and Now included!

          Hi all, Having a bit of trouble with an If formula when creating a formula field with currency return type. This is what I've got: If(Now()>=${Agreement History.Rent Review Due}, '${Agreement History.Holdover Price}', 'Abs(${Agreement History.Rent Achieved
        • Kerala Food Cess - Not applicable to Government Customers

          We are stuck while entering sales invoice - as Central and State Government Customers are exempted from Kerala Food Cess. Can Support Team help us? Phone / Chat / Email from Zoho - No support for third day in a row!
        • Automate pushing Zoho CRM backups into Zoho WorkDrive

          Through our Zoho One subscription we have both Zoho CRM and Zoho WorkDrive. We have regular backups setup in Zoho CRM. Once the backup is created, we are notified. Since we want to keep these backups for more than 7 days, we manually download them. They
        • 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
        • How to create Comparison across Period chart in a dashboard?

          Hi all How can I create this chart in a custom dashboard? The issue for me is that this chart is very small. The CRM module (unlike Projects module) has no ability to expand a chart. I want to make it larger, but also want to include it in a custom Forecast
        • Add Pinned Tickets to top of queue

          As an IT Helpdesk, we have some tickets where they will need to be looked at daily over a week or 2, and the ability to pin a ticket to the front/top of the queue would be handy as we can be reminded to take a look, rather than placing them on hold and
        • Holding Shift to keep selected tickets

          It is annoying trying to change the category of tickets and then closing them. You have to select them one by one, no way to 'hold down left click and drag your mouse down to select multiple'. Once you have selected them and you change the category, you
        • 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
        • Zoho CRM's V8 APIs are here!

          Hello everyone!!! We hope you are all doing well. Announcing Zoho CRM's V8 APIs! Packed with powerful new features to supercharge your developer experience. Let us take a look at what's new in V8 APIs: Get Related Records Count of a Record API: Ever wondered
        • Turning off the new UI

          Tried the new 'enhanced' UI and actively dislike it. Anyone know how to revert back?
        • Threads view for email sent from Cases module in CRM

          Hello all, Following the previous announcement regarding the support for the Send Email functionality from within the Cases module, the Email thread view is now available for emails sent from the Cases module. This enhancement is for better readability
        • Sync Zoho Docs and Google Drive

          Sync Zoho Docs and Google Drive -  how can I do it?
        • 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.
        • Canvas Detail View Related List Sorting

          Hello, I am having an issue finding a way to sort a related list within a canvas detail view. I have sorted the related list on the page layout associated with the canvas view, but that does not transfer to the canvas view. What am I missing?
        • Introducing Zoho CRM for Everyone: A reimagined UI, next-gen Ask Zia, timeline view, and more

          Hello Everyone, Your customers may not directly observe your processes or tools, but they can perceive the gaps, missed hand-offs, and frustration that negatively impact their experience. While it is possible to achieve a great customer experience by
        • Custom view placeholders

          Hi all, On some occasions it would be great to have placeholders setting up a custom view. Example in our case we have a field for a year. We would like to have a placeholder like $.{CurrentYear} that will insert the current year 2025 e.g. Now we have
        • Add Subform Field based on Record Field

          Hi All, I am struggling with finding a solution that can populate a subform field based on an existing field on the record. Use case is I have added Current Exchange Rate on a quote as a custom field, I then have a subform with Quoted items that include
        • Languages in Zobot

          Hello, I have found a list of supported languages for the Zobot. The information specifies the languages are supported in the following 3 features: SalesIQ supports 34 different languages in the following features. Resources (Articles, FAQs, Small Talks)
        • USA Military addresses

          When we have a client with a US military address adding them to the CRM, or having them fill in a form is a problem. Zoho Forms and CRM doesn't seem accommodate them correctly. It doesn't make sense for me to have to create a secondary data model for
        • Parentheses in System Path

          Zoho WorkDrive includes a mandatory parenthesis with the organization name in the desktop sync client. This adds parens to the system path. Many command-line applications do not allow for the use of parenthesis, so if you want to use a file saved on WorkDrive in a command line you cannot. Most major document syncing platforms do not allow parenthesis for this reason.
        • Hiring Staff Accountant in San Diego with ZohoBooks Experience

          Hello, We are a San Diego, CA company looking for an experienced Staff accountant or controller that has ZohoBooks experience for a full-time position. Please reach out if interested. Best, Ben
        • Workdrive 5.0 / API Documentation Workflows

          Hi Zoho, When will the API documentation of the workflows be published? We are interested in using it to trigger manual workflows from an external application. Greetings, Justin
        • Match Transaction > Filter | Allow wildcards in search

          The Filter function is useful for narrowing down to a specific set of transactions. It would be useful to have the ability to use wildcards in search. e.g. customer name "starts with" or " * " as a placeholder. e.g. "National * " instead of "National
        • Can your customer support speak every customer’s language?

          In today’s world, talking to your customers in their language is not a nice-to-have. It’s a must. It's one of the reasons that most businesses have trouble going global: Language barriers get in the way. Say, a customer from another part of the world
        • Sub accounts in Balance Sheet - specifically Assets

          I've added in a new account, IP Developed, under Intangible Assets. When I run the balance sheet report, it shows on its own without a header, just tacked on the bottom of all the other assets. I'd like it to show under Long Term Assets or Other Assets.
        • Change Last Name to not required in Leads

          I would like to upload 500 target companies as leads but I don't yet have contact people for them. Can you enable the option for me to turn this requirement off to need a Second Name? Moderation update (10-Jun-23): As we explore potential solutions for
        • Assign default Location + warehouse to Customer / Vendor

          Hello there. With the introduction of Locations I'm having to enter the warehouse for every single transaction which is getting really tiring and causes errors (easy to fix, but still). Does anybody know if there's a way to assign a default Location and
        • Check Sales Order for Duplicate Line Items by SKU

          It would be really nice if Zoho Books offered at least some of the features that the 30 year old software we migrated from did. When entering a Sales Order having some kind of warning pop-up if you try to enter the same item again would be very helpful.
        • Fifth Insight - Maximize the role of Departments

          The Wheels of Ticketing - Desk Stories Maximize the role of Departments What are Departments? Departments represent the various business divisions within your organization, each serving distinct functions that align with your products, geographical locations,
        • hey

          help me in zoho payroll
        • How to get custom estimate field to display on existing or new services?

          I am using FSM. I recently added a new custom field to Service Details to help categorize my services. I can see the newly added field as a column on the service list view. However, when attempting to update an existing or create a new service, I don't
        • Peppol Malaysia API

          Hi Zoho Books, my country Malaysia will going to implement "Peppol" (E-Invoicing), starting 1 Jul 2025 for all businesses. The government intends to provide API for accounting app. The workflow involves creating an invoice from accounting app, triggers
        • Global Sets for Multi-Select pick lists

          When is this feature coming to Zoho CRM? It would be very useful now we have got used to having it for the normal pick lists.
        • Sync Creator form submissions to WorkDrive folder

          I've made 10 Creator applications, and need to sync my each application's submissions into a WorkDrive folder. I need the form submissions to be PDF file type and sync to a specific folder for documentation purposes. I have tried to use a workflow, but
        • Kanban Deals not showing everything

          I have a deals (I call it Opportunities) module in CRM that shows various components of the opp. I'm trying to have a checkbox show up for the end user to be able to toggle it if they want an email to be sent when the change stages (in this example, it's
        • Multiple clients in one project

          Hi team, What is the possibility to have more than one client to be linked for one project in the Zoho Books? Our business model is to have a project, and this project have expenses/bills, as well, we issue invoices for this same project to several customers.
        • How to normalize CRM module when integrating with Survey?

          This question is about the problem with many-to-many relationships and Survey. One of the things our organization does is track people in our program and their jobs. We get new information from the people three times annually through Zoho Surveys. Survey
        • Next Page