Automation#22 Track Ticket Duration at Specific Status

Automation#22 Track Ticket Duration at Specific Status



Hello Everyone!

Welcome back to the Community Learning Series! Today, we explore how Zylker Techfix, a gadget servicing firm, boosted productivity by tracking the time spent at a particular ticket status in Zoho Desk. 

Zylker Techfix customized Zoho Desk’s ticket statuses to align with their servicing process. Here’s their workflow: when a gadget was submitted for service, the ticket entered “Open” status. After an initial examination, it moved to “Service” status, mapped to the “Hold” type while repairs were underway. Once repairs were complete, the ticket progressed to “Billing” and then to “Closed” after payment and delivery. To improve operations, Zylker Techfix wanted to know how long tickets stayed in “Service” status, giving them insights into potential delays and resource use. With a custom function, they tracked this time in a custom field, then used it to generate reports that highlighted areas for process improvement.

With this custom function, you can gain a clear view of your support timeline, identify bottlenecks, and serve clients more efficiently. Let’s dive into how you can implement this custom function to refine your own operations and drive productivity forward.

Prerequisites
1. Create a Custom Field
To track ticket duration at a StatusName (call it In progress) mapped to the Status Type On Hold
     
      1.1 Go to Setup (S) >> Customization >> Layouts and Fields.
             Select Tickets under Layouts and the Department in which you would like to track the ticket duration. 
      1.2 Create a custom single line field in the Tickets layout of the respective department. 
            1.2.1 Click on the layout, add a single line field with a label StatusTime. 
                      You can label the field with your preferred name. 
      1.3 Note the API names for the the single line field to insert into the custom function.     
            To find the API name, Click on the Gear wheel icon of the single line field.
            Click on Edit Properties, you will find the API Name under the Edit Field. Refer to Create Custom Fields

2. Create a connection
      2.1 Go to Setup(S) and choose Connections under Developer Space.
      2.2 Click Create Connection.
      2.3 Select Zoho OAuth under Default Connection.
      2.4 Set the connection name as deskconnection.
      2.5 Under Scope, choose the below scope values:
             Desk.tickets.READ
             Desk.tickets.UPDATE
      2.6 Click Create and Connect.
      2.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, Choose Status.  
8. Click Next.
 
9. Leave the Criteria section blank and click Next. (Add a criteria if you require it.) 
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 from the Value drop-down list, select Ticket Id under the Tickets Section.                                         
13. In the script window, insert the Custom Function given below:
  1. ///----<<<< User Inputs >>>>----
  2. deskURL = "https://desk.zoho.com";
  3. //Replace with your custom domain
  4. //Replace your Custom Field API Name to Update Desired Type Status Duration Ex: Open 
  5. durationApiName = "cf_status_name";
  6. // ex: "cf_open_time"
  7. //Replace your Desired Status Type Name Ex: Open
  8. statusType = "On Hold";
  9. // Open or On Hold or Closed
  10. //Replace the Status Name 
  11. statusName = "In Progress";
  12. // Ex: In Progress, Waiting for Reply, etc
  13. // ----<<<< Initial Configs >>>>----
  14. logs = Map();
  15. logs.insert("ticketId":ticketId);
  16. openHoursToUpdate = 0;
  17. openMinutesToUpdate = 0;
  18. onHoldHoursToUpdate = 0;
  19. onHoldMinutesToUpdate = 0;
  20. //---------------------------
  21. try 
  22. {
  23. // ---- start your logic from here ----
  24. ticketStatusLifeCycleInfo = invokeurl
  25. [
  26.   url :deskURL + "/api/v1/tickets/" + ticketId + "/statusLifeCycle"
  27.   type :GET
  28.   connection:"deskconnection"
  29. ];
  30. logs.insert("ticketStatusLifeCycleInfo":ticketStatusLifeCycleInfo);
  31. if(ticketStatusLifeCycleInfo != null && ticketStatusLifeCycleInfo.containsKey("statusLifeCycle") && ticketStatusLifeCycleInfo.get("statusLifeCycle").size() > 0)
  32. {
  33.   for each  statusInfo in ticketStatusLifeCycleInfo.get("statusLifeCycle")
  34.   {
  35.   statusType = statusInfo.get("statusType");
  36.   statusName = statusInfo.get("status");
  37.   if(statusType == statusType && statusName == statusName)
  38.   {
  39.     statusDuration = statusInfo.get("duration");
  40.     if(statusDuration != null && statusDuration != "")
  41.     {
  42.     statusDuration = statusDuration.replaceAll(" hrs","");
  43.     durationCollection = statusDuration.toCollection(":");
  44.     hourDuration = durationCollection.get(0);
  45.     minuteDuration = durationCollection.get(1);
  46.     openHoursToUpdate = openHoursToUpdate + hourDuration.toNumber();
  47.     openMinutesToUpdate = openMinutesToUpdate + minuteDuration.toNumber();
  48.     }
  49.   }
  50.   }
  51.   openHoursToUpdate = (openMinutesToUpdate / 60).toNumber() + openHoursToUpdate;
  52.   openMinutesToUpdate = openMinutesToUpdate % 60;
  53.   logs.insert("openHoursToUpdate":openHoursToUpdate);
  54.   logs.insert("openMinutesToUpdate":openMinutesToUpdate);
  55.   ticketUpdateParams = Map();
  56.   ticketUpdateParams.insert("cf":{durationApiName:openHoursToUpdate + ":" + openMinutesToUpdate});
  57.   logs.insert("ticketUpdateParams":ticketUpdateParams);
  58.   ticketUpdate = invokeurl
  59.   [
  60.   url :deskURL + "/api/v1/tickets/" + ticketId
  61.   type :PUT
  62.   parameters:ticketUpdateParams + ""
  63.   connection:"deskconnection"
  64.   ];
  65.   logs.insert("ticketUpdate":ticketUpdate);
  66. }
  67. }
  68. catch (errorInfo)
  69. {
  70. logs.insert("errorInfo":errorInfo);
  71. }
  72. info "logs: \n" + logs; 
  73. logs.insert("errorInfo":errorInfo);
  74. info "logs: \n" + logs;
NOTE
a. In Line 2, Replace ".com" with the domain extension based on your Data Center.
b. In Line 5, add the API name of the custom field created within the Tickets layout. 
c. In Line 8 and line 11, enter the status type and status name. 
14. Click Save to save the custom function.
15. Click Save again to save the workflow.

Creating Ticket Tracking Reports
You can generate Reports under Analytics to view the time duration of your tickets in one go. 
Go to the Analytics module >> Choose Reports >> Add Report >> Select Tickets module and Time Entry under Related modules. Refer to Create Custom Report 

Let us know how this custom helps improve your ticketing process.

Until next week,
Warm regards,
Lydia | Zoho Desk 

    • 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
    • Recent Topics

    • Delegates should be able to delete expenses

      I understand the data integrity of this request. It would be nice if there was a toggle switch in the Policy setting that would allow a delegate to delete expenses from their managers account. Some managers here never touch their expense reports, and
    • Add Save button to Expense form

      A save button would be very helpful on the expense form. Currently there is a Save and Close button. When we want to itemize an expense, this option would be very helpful. For example, if we have a hotel expense that also has room service, which is a
    • Using Zoho Desk to support ISMS process

      Hi, I am evaluating using Zoho Desk for security incident management. This seems to be aligned with Zoho Desk purpose as its just another type of incident. However in security incident management, ideally I can link incidents (tickets) with a risk from
    • Regarding the integration of Apollo.io with Zoho crm.

      I have been seeing for the last 3 months that your Apollo.io beta version is available in Zoho Flow, and this application has not gone live yet. We requested this 2 months ago, but you guys said that 'we are working on it,' and when we search on Google
    • Open filtered deals from campaign

      Do you think a feature like this would be feasible? Say you are seeing campaign "XYZ" in CRM. The campaign has a related list of deals. If you want to see the related deals in a deal view, you should navigate to the Deals module, open the campaign filter,
    • MTD SA in the UK

      Hello ID 20106048857 The Inland Revenue have confirmed that this tax account is registered as Cash Basis In Settings>Profile I have set ‘Report Basis’ as “Cash" However, I see on Zoho on Settings>Taxes>Income Tax that the ‘Tax Basis’ is marked ‘Accrual'
    • Limiting search or dependencies with an asterisk "*".

      I have a form with several dependency fields with options still developing for each field. Since these options were developing and not yet ready to be a selection in the field, I placed a filter for the dropdown field. In this filter, I selected fields
    • workflow not working in subform

      I have the following code in a subform which works perfectly when i use the form alone but when i use the form as a subform within another main form it does not work. I have read something about using row but i just cant seem to figure out what to change
    • Fetch data from another table into a form field

      I have spent the day trying to work this out so i thought i would use the forum for the first time. I have two forms in the same application and when a user selects a customer name from a drop down field and would like the customer number field in the
    • Zoho Creator as LMS and Membership Solution

      My client is interested in using Zoho One apps to deploy their membership academy offer. Zoho Creator was an option that came up in my research: Here are the components of the program/offer: 1. Membership portal - individual login credentials for each
    • Zoho FSM API Delete Record

      Hi FSM Team, It would be great if you could delete a record via API. Thank you,
    • Record comment filter

      Hi - I have a calendar app that we use to track tasks. I have the calendar view set up so that the logged in user only sees the record if they are assigned to the task. BUT there are instances when someone is @ mentioned in the record when they are not
    • Group Tax in Service Line Items

      Hi FSM Team! I noticed that when you update a tax in the service line item the group tax is not showing up as an option. Let me know what can be done thank you!
    • How to View Part Inventory and Warehouse Location When Creating a Work Order in Zoho FSM

      Hi everyone, We’re currently setting up Zoho FSM and would like to improve how our team selects parts when creating a Work Order. Right now, when we add a part or item to a Work Order, we can select it from our Zoho Inventory list but we don’t see any
    • FSM too slow today !!

      Anybody else with problem today to loading FSM (WO, AP etc.)?
    • CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive

      Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
    • Not able to Sign In in Zoho OneAuth in Windows 10

      I recently reset my Windows 10 system, after the reset when I downloaded the OAuth app and tried to Sign In It threw an error at me. Error: Token Fetch Error. Message: Object Reference not set to an instance of an object I have attached the screenshot
    • Mapping a custom preferred date field in the estimate with the native field in the workorder

      Hi Zoho, I created a field in the estimate : "Preferred Date 1", to give the ability to my support agent to add a preferred date while viewing the client's estimate. However, in the conversion mapping (Estimate to Workorder), I'm unable to map my custom
    • Runing RPA Agents on Headless Windows 11 Machines

      Has anyone tried this? Anything to be aware of regarding screen resolution?
    • Sync Contacts in iOS

      What does the "Sync Contacts" feature in the iOS Zoho Mail app do?
    • The sending IP (136.143.188.15) is listed on spamrl.com as a source of spam.

      Hi, it just two day when i am using zoho mail for my business domain, today i was sending email and found that message "The sending IP (136.143.188.15) is listed on https://spamrl.com as a source of spam" I hope to know how this will affect the delivery
    • Delegates - Access to approved reports

      We realized that delegates do not have access to reports after they are approved. Many users ask questions of their delegates about past expense reports and the delegates can't see this information. Please allow delegates see all expense report activity,
    • Split functionality - Admins need ability to do this

      Admins should be able to split an expense at any point of the process prior to approval. The split is very helpful for our account coding, but to have to go back to a user and ask them to split an invoice that they simply want paid is a bit of an in
    • What is a a valid JavaScript Domain URI when creating a client-based application using the Zoho API console?

      No idea what this is. Can't see what it is explained anywhere.
    • Feature Request: Ability to Set a Custom List View as Default for All Users

      Dear Zoho CRM Support Team, We would like to request a new feature in Zoho CRM regarding List Views. Currently, each user has to manually select or favorite a custom list view in order to make it their default. However, as administrators, we would like
    • Is there a way to request a password?

      We add customers info into the vaults and I wanted to see if we could do some sort of "file request" like how dropbox offers with files. It would be awesome if a customer could go to a link and input a "title, username, password, url" all securely and it then shows up in our team vault or something. Not sure if that is safe, but it's the best I can think of to be semi scalable and obviously better than sending emails. I am open to another idea, just thought this would be a great feature.  Thanks,
    • How can I see content of system generated mails from zBooks?

      System generated mails for offers or invices appear in the mail tab of the designated customer. How can I view the content? It also doesn't appear in zMail sent folder.
    • Single Task Report

      I'd like a report or a way to print to PDF the task detail page. I'd like at least the Task Information section but I'd also like to see the Activity Stream, Status Timeline and Comments. I'd like to export the record and save it as a PDF. I'd like the
    • Auto-response for closed tickets

      Hi, We sometimes have users that (presumably) search their email inbox for the last correspondence with us and just hit reply - even if it's a 6 month old ticket... - this then re-opens the 6 month old ticket because of the ticket number in the email's subject. Yes, it's easy to 'Split as new Ticket', but I'd like something automated to respond to the user saying "this ticket has already been resolved and closed, please submit a new ticket". What's the best way to achieve this? Thanks, Ed
    • How to Push Zoho Desk time logged to Zoho Projects?

      I am on the last leg of my journey of finally automating time tracking, payments, and invoicing for my minutes based contact center company - I just have one final step to solve - I need time logged in zoho desk to add time a project which is associated
    • Cannot access KB within Help Center

      Im working with my boss to customize our knowledge base, but for some reason I can see the KB tab, and see the KB categories, but I cannot access the articles within the KB. We have been troubleshooting for weeks, and we have all permissions set up, customers
    • Export to excel stored amounts as text instead of numbers or accounting

      Good Afternoon, We have a quarterly billing report that we generate from our Requests. It exports to excel. However if we need to add a formula (something as simple as a sum of the column), it doesn't read the dollar amounts because the export stores
    • why my account is private?

      when i post on zohodesk see only agent only
    • Field Dependency Not Working on Detail Page in Zoho Desk

      Hi Support Team, I’ve created field dependencies between two fields in Zoho Desk, and they are working correctly on the Create and Edit layouts. However, on the Detail page, the fields are not displaying according to the dependencies I’ve set — they appear
    • Getting ZOHO Invoice certified in Portugal?

      Hello, We are ZOHO partners in Portugal and here, all the invoice software has to be certified by the government and ZOHO Invoice still isn´t certified. Any plans? Btw, we can help on this process, since we have a client that knows how to get the software certified. Thank you.
    • Transition Criteria Appearing on Blueprint Transitions

      On Monday, Sept. 8th, the Transition criteria started appearing on our Blueprints when users hover over a Transition button. See image. We contacted Zoho support because it's confusing our users (there's really no reason for them to see it), but we haven't
    • Show/ hide specific field based on user

      Can someone please help me with a client script to achieve the following? I've already tried a couple of different scripts I've found on here (updating to match my details etc...) but none of them seem to work. No errors flagged in the codes, it just
    • Why I am unable to configure Zoho Voice with my Zoho CRM account?

      I have installed Zoho Voice in my Zoho CRM, but as per the message there is some config needed in Zoho Voice interface. But when I click on the link given in the above message, I get an access denied page.
    • Adding Multiple Products (Package) to a Quote

      I've searched the forums and found several people asking this question, but never found an answer. Is ti possible to add multiple products to a quote at once, like a package deal? This seems like a very basic function of a CRM that does quotes but I can't
    • 500 Internal Server Error

      I have been trying to create my first app in Creator, but have been getting the 500: Internal Server Error. When I used the Create New Application link, it gave me the error after naming the application. After logging out, and back in, the application that I created was in the list, but when I try to open it to start creating my app, it gives me the 500: Internal Server Error. Please help! Also, I tried making my named app public, but I even get the error when trying to do that.
    • Next Page