Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.



Hello Everyone,
Hear out Zylker Techfix’s Success Story on Smoother Ticket Transitions!

Zylker Techfix, a gadget servicing firm committed to quick repairs and timely deliveries, faced a challenge when ticket statuses changed automatically while moving between departments.
For instance, when the support team received a device, the ticket status changed from "Device Received" to "Servicing." However, when the ticket was transferred to the Engineering team for complex issues, it defaulted back to "Device Received," making it difficult for engineers to track the actual progress. This led to confusion and delays.
To overcome this, Zylker Techfix needed a way to retain ticket status across departments. This week’s custom function provided the perfect solution!
Now, ticket statuses remain unchanged when transferred between teams, ensuring clarity and smooth operations.

Follow these steps to configure your workflow rule and apply this solution seamlessly.
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 zohosupport.
  1.5 Disable the toggle for User Credentials of Login User
  1.6 Under Scope, choose the below scope values:
Desk.tickets.READ
  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. In the script window, insert the Custom Function given below:
  1. //----custom inputs------//
  2. deskURL = "https://desk.zoho.com"; //replace domain based on your Data center
  3. OrgId = "";   //Enter Org Id
  4. // ----- Initial Configs -----
  5. logs = Map();
  6. logs.put("ticketId",ticketID);

  7. //---------------------------
  8. try 
  9. {
  10. getTicketHistory = invokeurl
  11. [
  12. url :deskURL+"/api/v1/tickets/" + ticketID + "/History?limit=50"
  13. type :GET
  14. connection:"zohosupport"
  15. ];
  16. ticketHistory = getTicketHistory.get("data");
  17. previousDepartmentName = "";
  18. status = "Open";
  19. i = 0;
  20. moved = "false";
  21. for each  history in ticketHistory
  22. {
  23. if(history.get("eventName").toString().equalsIgnoreCase("TicketUpdated"))
  24. {
  25. for each  event in history.get("eventInfo")
  26. {
  27. if(event.get("propertyName") == "Department")
  28. {
  29. historychanges = event.get("propertyValue");
  30. previousDepartmentName = historychanges.get("previousValue").get("id");
  31. i = i + 1;
  32. moved = "true";
  33. }
  34. if(event.get("propertyName") == "Status")
  35. {
  36. historychanges = event.get("propertyValue");
  37. status = historychanges.get("previousValue");
  38. i = i + 1;
  39. }
  40. if(i == 3)
  41. {
  42. break;
  43. }
  44. }
  45. if(moved == "true")
  46. {
  47. break;
  48. }
  49. }
  50. }
  51. info previousDepartmentName;
  52. info status;
  53. if(previousDepartmentName != "")
  54. {
  55. updateTicket = zoho.desk.update(OrgId,"tickets",ticketID,{"status":status});
  56. info updateTicket;
  57. }

  58. }
  59. catch (errorInfo)
  60. {
  61.     logs.put("errorInfo",errorInfo);
  62. }
  63. info "logs: \n" + logs;
  64. if(logs.containKey("errorInfo"))
  65. {
  66.     throws "Error happen in the CF execution";
  67. }
Notes
NOTE
a. In Line 2, Replace ".com" with the domain extension based on your Data Center.
b. In Line 3, Enter your Org ID within "". 
13. Click Edit Arguments and include the argument mapping as below: 
  13.1 In the Name field, type ticketID and select Ticket Id under the Tickets Section.
14. Click Done.  
15. Click Save to save the custom function.
16. Click Save again to save the workflow.
Info
Important Note
This custom function will not apply if the destination department has blueprint enabled for all records.
Ensure that the workflow rule is set in all departments where you want the tickets to be moved.
The ticket status will be retained only if the same status is available in both the departments.
ZylkerTechfix found this solution helpful in ensuring smooth operations while keeping customers a priority. 
Share your experience on how this custom function has helped you! 
Regards,
Lydia | Zoho Desk

Reply
Reply to Lydia | Zoho Desk A
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )