This is a monthly series in which 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.
Unwanted tickets spamming your inbox and messing with your help desk reports? There is a way you can automatically delete such tickets, based on their subject lines or email IDs or a combination of both. The rules totally depend on your use case, but we have a simple script that can help you achieve this easily. Initiate this automation today and clear unwanted tickets easily and keep your reports accurate.
This automation involves two components: a custom function and a workflow rule. We will first start by creating the custom function and then set up the rules to execute the function.
To create the custom function, perform the following steps:
- Go to Setup, and under Automation, click Workflows.
- On the left panel under Workflows, click Custom Functions.
- Click New Custom Function > Write your own.
- Enter a name for the custom function.
- Add a description.
- In the Deluge field, add the following script:
jsonString = {"ticketIds":{ticketID}};
deleteTicket = invokeurl
[
url :"https://desk.zoho.com/api/v1/tickets/moveToTrash"
type :POST
parameters:jsonString.toString()
connection: "zohodesk"
]; - Argument Mapping > Name: ticketID & Value: Ticket Id
To create the workflow rule, perform the following steps:
- Go to Setup, and under Automation, click Workflows.
On the left panel, under Workflows, click Rules > Create Rule.
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, perform the following steps:
If you want to delete tickets based on the content in the Subject field, add this criteria:
Subject contains <keywords separated by commas.
If you want to delete tickets based on the content in the Subject field and the email ID of the contact, add this criteria:
Subject contains <keywords separated by commas>
AND/OR
Email contains <email ids separated by commas>
If you want to delete all tickets except the ones that have a specific content in the Subject field and/or were sent by a particular sender, add this criteria:
Subject doesn't contain <keywords separated by commas>
AND
Email doesn't contain <email ids separated by commas>
Click Next
In the Actions section, perform the following steps:
- Click the + icon and select Existing link next to Custom Functions. A list of all the Custom Functions that you have created will be displayed.
- Select the one that you created earlier
- Click Save
Important Note: Please make sure to add the accurate criteria, based on which the custom function must be executed. If you do not add any criteria, the rule will execute and delete all tickets in the department.