Want to categorize your tickets by topics as soon as an agent responds? Here's how…
We really needed to group our Zoho Desk tickets to categories to analyze them in Zoho Analytics. This custom functions does it for you. Thanks to Zoho employee John and his colleagues who gave me the idea at Zoholics 2022 in Frankfurt.
This custom function is fired via a workflow every time there is an agent response.
- // Description: Fetches the topic of at ticket using a shortcode given from a template. Inserting the topic to the custom field cf_topic.
- // ticketID is given as an argument for this function
- // Inserting the Organisation ID:
- orgID = 2**********8;
- data = Collection();
- data.insert("#SC_GEN":"General");
- // +++++++++++++++++++++++++++++++++++
- // Insert your topic, e.g.:
- // data.insert("YOUR FIRST SHORTCODE":"YOUR FIRST TOPIC");
- // +++++++++++++++++++++++++++++++++++
- // Use the Shortcodes for the For-Loop:
- dataKeys = data.keys();
- // Get the latest agent reply as a thread:
- thread = zoho.desk.getRelatedRecords(orgID,"threads","tickets",ticketID,0,1);
- // Getting the HTML code of the latest reply
- replyID = thread.get("data").toString().get("id");
- reply = zoho.desk.getRelatedRecordById(orgID,"threads",replyID,"tickets",ticketID);
- replyText = reply.get("content");
- // Using foundKey as the resulting shortcode
- foundKey = null;
- for each key in dataKeys
- {
- if(replyText.containsIgnoreCase(key))
- {
- foundKey = key;
- }
- }
- // Checking if shortcode was actually found
- if(foundKey != null)
- {
- foundValue = data.get(foundKey).toString();
- info "Found Value. Using: ";
- }
- else
- {
- info "Found no value.";
- }
- info foundValue;
- // Extracting the topic for the found shortcode
- customFieldsChild = Map();
- customFieldsChild.put("Topic",foundValue);
- customFieldsParent = Map();
- customFieldsParent.put("customFields",customFieldsChild);
- response = zoho.desk.update(orgID,"tickets",ticketID,customFieldsParent);
The prerequisite is that shortcodes are implemented in templates that stand for a topic. For example, we have inserted the string "#SC_DE_B2B" under the text of a ticket template and colored it white in order to be able to search for the text as a shortcode in the function. All B2B-regarding templates will contain this string and will result to the selection "B2B informations".
In addition, there is a "Topic" picklist in the ticket layout, in which the respective topics are stored.
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.