
Hello Everyone!Ever found yourself juggling multiple service requests that seem like pieces of a larger puzzle? Managing interconnected tickets can be challenging, especially when updates on child tickets need to be tracked. That’s where our custom function steps in!
This week, we introduce a solution to notify the parent ticket owner whenever changes occur in child tickets. The Parent-Child Ticketing feature in Zoho Desk allows you to link related tickets for better tracking and collaboration. While different agents managed child issues, the parent ticket owner needed timely updates to stay connected with customers.
Here’s the custom function to address this – follow the steps below to configure it!
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 Desk under Default Services.
1.4 Set the connection name as deskconnection.
1.5 Under Scope, choose the below scope values:
Desk.tickets.READ
1.6 Click Create and Connect.
1.7 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 Field Update and select Status from the drop-down menu.
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 and 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:
- // ----<<<< User Inputs >>>>----
- // --- Replace ".com" with appropriate domain extension based on your DC ---
- deskURL = "https://desk.zoho.com";
- //Replace with your preferred Email Notification Subject
- subject = "Child ticket status update";
- //Replace with your preferred Email content for the ticket owner
- content = "The Child ticket associated to your parent ticket has a status update";
- // ----<<<< Initial Configs >>>>----
- logs = Map();
- parentTicketId = null;
- logs.insert("ticketId":ticketId);
- //---------------------------
- try
- {
- // ---- start your logic from here ----
- ticketInfo = invokeurl
- [
- url :deskURL + "/api/v1/tickets/" + ticketId
- type :GET
- headers:{"featureFlags":"lookUp"}
- connection:"deskconnection"
- ];
- logs.insert("ticketInfo":ticketInfo);
- if(ticketInfo != null && ticketInfo != "" && ticketInfo.get("relationshipType") == "Child")
- {
- parentTicketInfo = ticketInfo.get("parentTicket");
- if(parentTicketInfo != null && parentTicketInfo != "" && parentTicketInfo.containsKey("id"))
- {
- parentTicketId = parentTicketInfo.get("id");
- }
- }
- if(parentTicketId != null)
- {
- parentTicketInfo = invokeurl
- [
- url :deskURL + "/api/v1/tickets/" + parentTicketId + "?include=assignee"
- type :GET
- connection:"deskconnection"
- ];
- logs.insert("parentTicketInfo":parentTicketInfo);
- parentTicketAssigneeInfo = parentTicketInfo.get("assignee");
- if(parentTicketAssigneeInfo != null && parentTicketAssigneeInfo != "" && parentTicketAssigneeInfo.containsKey("email"))
- {
- parentTicketOwnerEmail = parentTicketAssigneeInfo.get("email");
- sendmail
- [
- from :zoho.adminuserid
- to :parentTicketOwnerEmail
- subject :subject
- message :content
- ]
- }
- }
- }
- catch (errorInfo)
- {
- logs.insert("errorInfo":errorInfo);
- }
- info "logs: \n" + logs;
- if(logs.containKey("errorInfo"))
- {
- throws "Error happen in the CF execution";
- }
NOTE
a. In Line 2, Replace ".com" with the domain extension based on your Data Center.
b. In Line 5 and 7, insert the Email subject and Email content that has to be sent to the Ticket Owner
14. Click Save to save the custom function.
15. Click Save again to save the workflow.
Our Community Series is here to provide practical tips and solutions. If you have any questions or suggestions, feel free to reach out to us at support@zohodesk.com—we’d love to hear from you! Until next time,
Regards,
Lydia | Zoho Desk