This is a monthly series designed to help you get the best out of Desk. We take our cue from what's being discussed or asked about the most in our community. Then we find the right use cases that specifically highlight solutions, ideas and tips to optimize your customer support with the automation capabilities of Zoho Desk.
With the help of Custom fields in Zoho Desk you can extract context that is specific to your business. For example, a travel company might want their customers to enter PNR numbers while submitting their tickets. Or, a product manufacturing company may have a mandatory field for serial numbers in the add ticket form.
But when your customers send in emails with vital information like Order numbers and PNR numbers listed in the email content, extracting it to add it to the custom fields can be a challenge. Here's an automation designed to help you sidestep this challenge. It extracts specific context from the email content and updates the custom fields automatically.
Let's take the example of "Order Number" to understand how we can achieve this automation.
You may recall how we replaced Auth-tokens with Connections for all the existing custom functions. So the first step to making the most of ZohoDesk's automation capabilities is to create a connection to be used in the custom function later.
To create a connection, carry out the following steps:
- Click on Setup > Developer Space > Connections
- Click Create Connection
- In the Pick Your Service section, under Pre-Defined Services find and select Zoho OAuth
- In the Connection Details section, add zohodesk as the Connection Name and Connection LinkName
- In the Choose Scopes list, select all values that start with 'Desk.' and ending with '.ALL' and then include Desk.search.READ, Desk.products.READ
- Click Create and Connect
- In the page that appears, click Connect
- If you have more than one portal associated, select the Portal to which this connection should be added and click Accept.
Say you receive an email with the content:
Order Number: 4345312
Contact Name: Sundar
To extract the value of the Order Number from the above email, proceed with these steps:
- Go to Setup, and under Automation, click Workflows.
- On the left panel, under Workflows, click Rules > Create Rule.
In the Basic Information section, carry out the following steps: - In the Module drop-down menu, select Tickets.
- Enter a name and description for the rule.
- If you want to activate the rule right away, select the Active checkbox. Else, you can just create the rule now and activate it later, on the Rules page.
- Click Next.
In the Execute on section, perform the following steps: - Select the Create checkbox to execute this rule every time a new ticket is created.
- Click Next.
In the Criteria section, do not select any criteria and move to the next section.
In the Actions section, carry out the following steps: - Click the + icon and select Custom Functions > New
- Click Edit Arguments
- In the Name field type TicketID, and from the Value drop-down list select Ticket Id under Ticket Information.
- In the script window, input the Custom Function you find below:
orgId = "paste orgId here";
fromWord = "Order Number:";
toWord = "Contact Name:";
lenfromWord = fromWord.length();
T_Info = invokeurl
[
url :"https://desk.zoho.com/api/v1/tickets/" + TicketID + "/latestThread?include=plainText"
type :GET
connection:"zohodesk"
];
plainText = T_Info.getJSON("plainText");
orderNumber = plainText.subText(plainText.indexOf(fromWord) + lenfromWord ,plainText.indexOf(toWord));
updateTicket = zoho.desk.update(orgId,"tickets",TicketID,{"cf":{"cf_order_number":orderNumber}});
info updateTicket;
Once the steps are completed, the value will be updated in a custom field named Order Number and the API name of the field that is cf_order_number. For other business scenarios, you can replace "Order Number" with other keywords that describe the specific values you need to extract.