Automation #16: Automate Ticket Reopening on Scheduled Timestamp

Automation #16: Automate Ticket Reopening on Scheduled Timestamp



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.
  1. // ----<<<< User Inputs >>>>----
  2. //Replace deskURL with the URL based on your DC
  3. deskURL = "https://desk.zoho.com";
  4.  
  5. //Replace your custom date field's API Name
  6. cfAPIName = "cf_action_date";
  7.  
  8. // Replace *********** with your department Id
  9. departmentId = ***********;
  10.  
  11. // ----<<<< Initial Configs >>>>----
  12. logs = Map();
  13. ticketIdList = List();
  14. currDate = now.toText("YYYY-MM-dd");
  15.  
  16. //---------------------------
  17. try {
  18.     // ---- start your logic from here ----
  19. ticketSearch = invokeUrl
  20. [
  21. url : deskURL + "/api/v1/tickets/fieldSearch"
  22. type : GET
  23. parameters : { "from" : 0 , "limit" : 50 , "field1" : cfAPIName+":"+currDate,"departmentId":departmentId }
  24. connection : "deskconnection"
  25. ];
  26. logs.insert("ticketSearch":ticketSearch);

  27. if ( ticketSearch != null && ticketSearch != "" && ticketSearch.containsKey("data") && ticketSearch.get("data").size() > 0 )
  28.     {
  29. for each tkt in ticketSearch.get("data")
  30.         {
  31. ticketIdList.add(tkt.get("id"));
  32.         }
  33.     }
  34. logs.insert("ticketIdList":ticketIdList);
  35. if ( ticketIdList.size() > 0 )
  36.     {
  37. bulkUpdateTickets = invokeUrl
  38. [
  39. url : deskURL + "/api/v1/tickets/updateMany"
  40. type : POST
  41. parameters : { "ids" : ticketIdList , "fieldName" : "status" , "fieldValue" : "Open" } + ""
  42. connection : "deskconnection"
  43. ];
  44. logs.insert("bulkUpdateTickets":bulkUpdateTickets);
  45.     }
  46. }
  47. catch(errorInfo) {
  48.     logs.insert("errorInfo": errorInfo);
  49. }
  50.  
  51. info "logs: \n" + logs;
Note : In line 3, replace the URL with the Desk URL corresponding to your DC.
[ Example: For US DC, the url will be https://desk.zoho.com
                         India DC, the url will be https://desk.zoho.in
                         EU DC, the url will be https://desk.zoho.eu]
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. 

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation
                                              • Sticky Posts

                                              • Zoho Desk Virtual Meetup: US Central, October 5 - 7, 2021

                                                After the interactive Virtual Meetups in the other regions, we are starting with the US Central and Midwest regions from October 5 to October 7, 2021. The dates for other regions will be announced soon.  At this event, we will explore the topics which
                                              • Register for Zoho Desk Beta Community

                                                With the start of the year, we have decided to take a small step in making the life of our customers a little easier. We now have easy access to all our upcoming features and a faster way to request for beta access. We open betas for some of our features
                                              • Ask the Experts 10: A 5-hour online Q&A on Zoho Desk Best Practices

                                                Welcome to Zoho Desk's Ask the Experts session! This is a monthly discussion on our  forums; wherein a panel of experts will take on questions  specific to topics related to Zoho Desk. The panel will be available for a 5-hour period and will answer any questions posted here.   Let's begin the year learning some best practices from our experts. In this month's ATE we are opening the floor to questions on how to use Zoho Desk the best way.  If you have a business use case but not sure if Workflow is
                                              • Share your Zoho Desk story with us!

                                                Tell us how you use Zoho Desk for your business and inspire others with your story. Be it a simple workflow rule that helps you navigate complex processes or a macro that saves your team a lot of time; share it here and help the community learn and grow with shared knowledge. 
                                              • Ask the Experts 7: A 5-hour online Q&A on Telephony and Call Module

                                                Welcome to Ask the Experts session! This is a monthly discussion in forums; each session, a panel of experts will take questions on specific topics related to Zoho Desk. The panel will be available for a 5-hour period and answer any questions posted here. In this month's Ask the Experts, we will take questions on everything related to Telephony and the Call Module in Zoho Desk. We will discuss the following aspects:  Integration with different Telephony vendors Routing calls to agents Converting


                                              Manage your brands on social media



                                                    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

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now