Automation#27: Retain Ticket Owner on Moved Tickets

Automation#27: Retain Ticket Owner on Moved Tickets


Hello Everyone!
This week, we present to you a custom function that retains the ticket owner when a ticket is moved from one department to another.
Here’s more to help you understand the custom function:
At Zylker Techfix, Alex, the Support Engineer manages customer interactions when gadgets are submitted for servicing. Alex creates a ticket for each device and ensures customers feel supported. However, when a device requires advanced troubleshooting, the ticket is transferred to the Technical Engineering department. By default, this transfer often changes the ticket owner or leaves it unassigned, causing Alex to lose visibility and leaving customers feeling disconnected.

To solve this, Zylker Techfix used this custom function that retains Alex as the ticket owner during inter-department transfers. This allows Alex to stay updated, connect with customers, and provide timely updates while the Technical Engineers focus on resolving the issue. With this solution, Zylker Techfix ensures seamless collaboration and a better customer experience, maintaining trust and delivering quick resolutions.

Prerequisites
1. Create a connection
  1.1 Go to Setup(S) and choose Connections under Developer Space.
  1.2 Click Create Connection.
  1.3 Select Zoho OAuth under Default Connection.
  1.4 Set the connection name as deskconnection.
  1.5 Disable the toggle for User Credentials of Login User.
  1.6 Under Scope, choose the below scope values:
Desk.tickets.READ
Desk.tickets.UPDATE
  1.7 Click Create and Connect.
  1.8 Click Connect and click Accept.
Connection is created successfully.

Create a Workflow Rule
1. Go to Setup, choose Workflows under Automation
2. Under Workflows, click Rules >> Create Rule.

In the Basic Information section,
3. Select Tickets from the drop-down menu under Module.
4. Enter a Rule Name and Description for the rule.
5. If you want to activate the rule right away, select the Active checkbox. Else, create the rule and activate it later.
6. Click Next.
 
In the Execute on section, follow these steps:
7. Select Create.   
8. Click Next.
 
9. In the Criteria section, add criteria if required. Click Next. 
10. In the Actions section, click the + icon and select New next to Custom Functions.
11. Enter a Name and Description for the custom function. 
12. Under Argument Mapping, give a desired Method Name. Map the arguments as below: 
  12.1 In the Argument Name field, type ticketID and select Ticket Id under the Tickets Section.                                         
13. In the script window, insert the Custom Function given below:
  1. deskUrl = "https://desk.zoho.com";      //Edit the domain based on your DC
  2. getTicketHistory = invokeurl
  3. [

  4. url :deskUrl + "/api/v1/tickets/" + ticketID + "/History?limit=50"

  5. type :GET

  6. connection:"deskconnection"
  7. ];
  8. ticketHistory = getTicketHistory.get("data");
  9. info ticketHistory;
  10. prevTicketOwner = "";
  11. i = 0;
  12. for each  history in ticketHistory
  13. {

  14. if(history.get("eventName").equalsIgnoreCase("TicketUpdated"))

  15. {

  16. historychanges = history.get("eventInfo");

  17. for each  hchanges in historychanges

  18. {

  19. if(hchanges.get("propertyName").equalsIgnoreCase("Department"))

  20. {

  21. i = i + 1;

  22. }

  23. if(hchanges.get("propertyName").equalsIgnoreCase("Case Owner"))

  24. {

  25. if(hchanges.get("propertyValue").containKey("previousValue"))
  26. {
  27. prevTicketOwner = hchanges.get("propertyValue").get("previousValue").get("id");

  28. i = i + 1;

  29. }

  30. }

  31. }

  32. info prevTicketOwner;

  33. }

  34. if(i == 2)

  35. {

  36. break;

  37. }
  38. }
  39. jsonString = {"assigneeId":prevTicketOwner};
  40. updateTicket = invokeurl
  41. [

  42. url :deskUrl + "/api/v1/tickets/" + ticketID

  43. type :PATCH

  44. parameters:jsonString + ""

  45. connection:"deskconnection"
  46. ];
  47. info updateTicket;
NOTE
In Line 2, Replace ".com" with the domain extension based on your Data Center.
14. Click Save to save the custom function.
15. Click Save again to save the workflow.
Additional Note
1. The Ticket Owner will be retained only if the agent is part of the department. 
2. Set up the workflow rule in all departments where tickets may be moved, ensuring the owner stays the same and the function works as intended.
This custom function streamlines workflows and enhances collaboration, ensuring a seamless customer experience. By keeping the original ticket owner, it helps to deliver efficient, customer-focused service every step of the way.

Until next time,
Regards,
Lydia | Zoho Desk 

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner




                                                            • Sticky Posts

                                                            • 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
                                                            • 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. 
                                                            • Tip #1: Learn to pick the right channels

                                                              Mail, live chat, telephony, social media, web forms—there are so many support channels out there. Trying to pick the right channels to offer your customers can get pretty confusing. Emails are most useful when the customer wants to put things on record. However, escalated or complicated issues should not be resolved over email because it's slow and impersonal.  When you need immediate responses, live chat is more suitable. It's also quick and convenient, so it's the go-to channel for small issues. 
                                                            • Welcome to Zoho Desk Community - Say hello here!

                                                              Hello everyone! Though we have been here for a while, it’s time to formally establish the Zoho Desk Community; we’re really happy to have you all here! This can be the place where you take a moment to introduce yourself to the rest of the community. We’d love to hear all about you, what you do, what company or industry you work for, how you use Zoho Desk and anything else that you will like to share! Here’s a little about me. I am Chinmayee. I have been associated with Zoho since 2014. I joined here
                                                            • Webinar 1: Blueprint for Customer Service

                                                              With the launch of a host of new features in Zoho Desk, we thought it’ll be great to have a few webinars to help our customers make the most of them. We’re starting off with our most talked about feature, Blueprint in Zoho Desk. You can register for the Blueprint webinar here: The webinar will be delivered by our in-house product experts. This is a good opportunity to ask questions to our experts and understand how Blueprint can help you automate your service processes. We look forward to seeing


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator 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


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方