Automation #7 - Auto-update Email Content to a Ticket

This is a monthly series where we pick some common use cases that have been either discussed or most asked about in our community and explain how they can be achieved using one of the automation capabilities in Zoho Desk.
Email is one of the most commonly used support channels and with Desk's easy setup you can easily convert your customer conversation into tickets. All you need to do is to forward the emails received at your support mailbox to Zoho Desk and every customer conversation is converted into tickets with a unique ticket ID.
The subject of the email is pulled and displayed as a tickets with a ticket ID in Desk. If you want to go a step ahead and pull the email content into the ticket description, then automations can come in handy. Using a simple custom script and a workflow rule you can create an automation to automatically update the email content in to the description field of the ticket in Desk. This helps you have all the context you need to resolve a ticket at one single place and avoid going back and forth between your inbox and help desk platform.
To create the workflow rule, perform the following steps:
- Go to Setup, and under Automation, click Workflows.
-
Click "Create Rule" from top right corner.
In the Basic Information section, perform 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, add "Channel Is Email" and click "Next".
In the Actions section, perform the following steps:
-
Click the + icon under "Action" and select "New" next to Custom Functions
-
Enter a name and description for the custom function.
-
In the script window, input the Custom Function you find below:
- OrgID = Paste your OrgID here;
- getthreads = zoho.desk.getRelatedRecords(OrgID,"threads","tickets",ticketId,0,1);
- threadid = getthreads.getJSON("data").getJSON("id");
- getthreadcontent = zoho.desk.getRelatedRecordById(OrgID,"threads",threadid,"tickets",ticketId).getJSON("content");
- updateticket = zoho.desk.update(OrgID,"tickets",ticketId,{"description":getthreadcontent});
- info updateticket;
-
Click "Edit Arguments"
-
In the Name field type ticketId, and from the Value drop-down list select Ticket Id under Ticket Information.
-
Click "Save" to save the custom function.
-
Click "Save" again to save the workflow.
Important Note: In line 1, replace your OrgId. You can get your OrgID by navigating to Setup > Developer Space > API > OrgId.