Hello Everyone!
This edition uncovers the option to schedule reopening a ticket automatically.
Zylker Finance tracks insurance policyholder activities through Zoho Desk. For policyholders who pay monthly premiums, tickets are closed upon payment completion. To efficiently follow up with its customers every month, Zylker Finance automatically reopens existing tickets on a specific date rather than creating new ones. This helps insurance agents ensure they do not miss any customer interactions.
Zylker Finance automates this process using a custom function in Schedules to ensure efficient tracking and operations management. Let's delve into the setup to understand the configurations.
Prerequisites
1. Create a custom date field in the Ticket layout.
Navigate to Setup >> Customization >> Layouts and Fields >> Choose the preferred department and select the layout to add a custom date field. Assign a Preferred Name to the Date Field.
Click on the gear
icon of the custom date field and note the API name.
2. Fetch Department ID
To fetch department ID, go to Setup >> General >> Departments >> click on the preferred department. Go to the address bar and find the last number series in the URL; this is the department ID. Copy the ID appended in the URL and paste it into line 9 of the custom function for the departmentId value.
3. Create a connection
3.1 Go to Setup >> Connections under Developer Space
3.2 Click Create Connection.
3.3 Select Zoho OAuth under Default Connection.
3.4 Give the connection name as deskconnection.
3.5 Under Scope, include the below scopes
Desk.tickets.READ
Desk.search.READ
Desk.tickets.UPDATE
3.6 Click Create and Connect.
3.7 Click Connect and click Accept.
Connection is created successfully.
Create Schedules
1. Go to Setup >> Automation, choose Schedules.
2. Click on New Schedule in the top right corner. (Ensure that the correct department is selected.)
3. Give a preferred Name and Description for the Schedule.
4. Under Execute on, choose the preferred Date and Time for the schedule to begin execution.
5. Under Repeat, choose the preferred frequency as Every Day. Under Ends, choose Never.
6. Under Functions, click on Create Function.
7. Give a Name and Description for the function. Paste the below custom function in the script window.
- // ----<<<< User Inputs >>>>----
- //Replace deskURL with the URL based on your DC
- deskURL = "https://desk.zoho.com";
-
- //Replace your custom date field's API Name
- cfAPIName = "cf_action_date";
-
- // Replace *********** with your department Id
- departmentId = ***********;
-
- // ----<<<< Initial Configs >>>>----
- logs = Map();
- ticketIdList = List();
- currDate = now.toText("YYYY-MM-dd");
-
- //---------------------------
- try {
- // ---- start your logic from here ----
- ticketSearch = invokeUrl
- [
- url : deskURL + "/api/v1/tickets/fieldSearch"
- type : GET
- parameters : { "from" : 0 , "limit" : 50 , "field1" : cfAPIName+":"+currDate,"departmentId":departmentId }
- connection : "deskconnection"
- ];
- logs.insert("ticketSearch":ticketSearch);
- if ( ticketSearch != null && ticketSearch != "" && ticketSearch.containsKey("data") && ticketSearch.get("data").size() > 0 )
- {
- for each tkt in ticketSearch.get("data")
- {
- ticketIdList.add(tkt.get("id"));
- }
- }
- logs.insert("ticketIdList":ticketIdList);
- if ( ticketIdList.size() > 0 )
- {
- bulkUpdateTickets = invokeUrl
- [
- url : deskURL + "/api/v1/tickets/updateMany"
- type : POST
- parameters : { "ids" : ticketIdList , "fieldName" : "status" , "fieldValue" : "Open" } + ""
- connection : "deskconnection"
- ];
- logs.insert("bulkUpdateTickets":bulkUpdateTickets);
- }
- }
- catch(errorInfo) {
- logs.insert("errorInfo": errorInfo);
- }
-
- info "logs: \n" + logs;
![](https://static.zohocdn.com/zoho-desk-editor/static/images/file.png)
Note : In line 3, replace the URL with the Desk URL corresponding to your DC.
In line 6, replace cf_action_date with the your custom date field's API Name. In line 9, give the department ID.
8. Click Save to save the script.
9. Click Save again to save the created schedule.
Implementation
When the custom date field matches the Execute On date in the schedule, the ticket will move to the open state.
We hope our updates enhance your experience with Zoho Desk, enabling you to offer great customer support. Stay tuned for updates on features and functions in Zoho Desk.