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,
- Tags in Zoho CRM
- ZDK functions related to Tags
- Use Case
- Solution
- Summary
- 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
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
Note
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
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.
- 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!