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 


      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • 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

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

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

                              Zoho CRM コンテンツ






                                ご検討中の方

                                  • Recent Topics

                                  • Multiple columns in a form

                                    I am evaluating Zoho Creator. However, I am seeing almost no layout control on a form.  Just a basic 1 or 2 column format that is then imposed on the entire form.  That's not going to work for many, many real world cases. We need multiple columns per line, and we need each line/section to occupy a single column or be able to span the columns.   Someone please tell me that I'm missing something and the capability is actually there.  
                                  • Global search

                                    Hi! I think it would be great to have a global search that would give you results from all records of a database, no only for a single field of a single form as we have now. Thanks!
                                  • Any insights about API/v2? Having problem for a while.

                                    I don't know why it is throwing a 404 error, my report name is correct. Has someone had this issue and how you fix it?
                                  • Custom Related List Inside Zoho Books

                                    Hello, We can create the Related list inside the zoho books by the deluge code, I am sharing the reference code Please have a look may be it will help you. //..........Get Org Details organizationID = organization.get("organization_id"); Recordid = cm_g_a_data.get("module_record_id");
                                  • Edit QR code with redirect to form

                                    Guten morgen, wir haben ein Formular Reklamation_erstellen. Dort soll ein QR Code erstellt werden, der im Lieferschein angezeigt wird. Beim Scannen auf dem soll das jeweilige Formular zum BEARBEITEN geöffnet werden. Leider bekomme ich es nur so hin, dass
                                  • Getting all the ingredients together for baking an app

                                    Good day everyone. After reading a lot of the help docs and watching videos, I now started on my app. To prevent hours and hours wasted on going down the wrong track, I would like some clarification on the following. But first some background: I have
                                  • Conditional Layouts On Multi Select Field

                                    How we can use Conditional Layouts On Multi Select Field field? Please help.
                                  • Help Needed with Configuring ZC Microservice

                                    I'm attempting to create a simple microservice, but am running into problems with scope and auth. Using Custom API Builder, here's my setup: 1. Method: GET 2. Auth: OAuth2 3. User Scope: All users 4. Response: Standard 5. Function: A function that returns
                                  • Creator Simplified #10: Predefine Form Field Values and Make Them Read-Only for Users

                                    Hey Creators, Ready for this week's tip in the Creator Simplified series? Today, we will explore how to have read only fields in a form. Use Case: Assume a scenario where the default value for a Department field needs to be English Literature, but you
                                  • Zoho Books | Product updates | November 2025

                                    Hello users, We’ve rolled out new features and enhancements in Zoho Books. From translating email notification templates to the new transaction locking restrictions, explore the updates designed to enhance your bookkeeping experience. Making Tax Digital
                                  • Direct link to Record Summary

                                    Hi everyone, In one of my reports, I have built a Record Summary template to display the details of one record. I would like to be able to link directly to this Record Summary once I submit a new record, without having to go to the list of records first and click on View. Is there a possibility to do so ?  Should I use the URL by passing some parameters ? Thank you very much for your help ! Guillaume
                                  • To Assign a genrated pdf to a file upload field using delug

                                    content = "<html><body>HTML Content on page One <div style='page-break-after:always'></div> HTML Content on page Two </body></html>"; file = zoho.file.convertToPDF(content); file.setFileName("Name of the file"); <variableName> = <FormLinkName>[ID == input.ID];
                                  • Zoho Mail : Email Outgoing Blocked

                                    I suddenly received the following message yesterday. I cannot send any mail. Please resolve as soon as possible, I cannot work without sending email. Dear User, We regret to inform you that your email outgoing has been blocked and you will not be able
                                  • Creator and Tables

                                    Good day. I am trying to create my first application. I have imported my data into Tables and am creating my app in Creator. I do not see my tables and cannot see how to write forms data to a table. Even the Workflow just uses the form. In one of the
                                  • Calendar week view: Today + 6

                                    Is there anyway to have the calendar change dynamically based on the date? Due to the amount of events, we only display a week at a time, but towards the end of the week, we can no longer see ahead to next week (without changing it manually every time).
                                  • customer Name and address details

                                    i created one application there is no customer details in that . how to add customer details and
                                  • Recalculate every row in the subform

                                    Hello, Can anyone help me with a script, please? I have an issue. Sometimes it happens, that in a multi row subform one of the rows show an incorrect row total value. Not really understand how it can happen, if I have a 20 row subform, 19 rows show correct
                                  • Creating Repeat Forms that remove redundancies

                                    I wanted to understand if you can make multi-layer forms that reduce the need for users to input information in again and again. We want a form that our suppliers fill out per ingredient they sell, and the end result should have the Ingredient (Section
                                  • What is the difference between the free plan and the mail lite plan?

                                    What is the difference between the free plan and the mail lite plan? How many emails can I send per day?
                                  • Unblock email

                                    Hi The outgoing mail from a client of me is blocked. I already made tickets and tickets are send to the EU desk but nobody is responding. The problem is already 4 days! There is absolutely no help from the support. I am really not satisfied at all! Can
                                  • Domain verification failure

                                    Hello Zoho Support, I purchased my domain directly through Zoho Mail, but the domain verification keeps failing with the message “TXT verification failed.” I’ve already waited and retried several times, but it still won’t verify. Could you please manually
                                  • Unable to send message;Reason:554 5.1.8 Email Outgoing Blocked.

                                    My email account is unable to send emails, and I urgently need to use it. How can I resolve this?If there is anything we have done wrong, please let us know in advance so we can actively cooperate to improve. User ID: 850482493
                                  • URGENT: Email stopped workin - can't access admin panel

                                    For some reason email sending stopped working. When I try to send an email it fails with "Unable to send message;Reason:451 4.7.1 Temporary system error" I can receive email just fine I see in my notifications some errors about the MX records, however
                                  • Can I associate an invoice to a Project after the fact?

                                    We have generated an invoice but would like to assoicate it to a Zoho Project after the fact.  Is there any way to accomplish that? Thanks, Scott
                                  • Emails I send as a cc or bcc NEVER GO THROUGH TO THA RECEIVER !!

                                    every time i send a cc or bcc copy of an email to anyone when I’m using my zohomail.com email - no one ever gets the cc of bcc copy if the email: why???? And i triple check that the email addresses are correct; then i get back an email message (EVERYTIME)
                                  • Cannot see correct DNS config for mail after moving domain to another provider

                                    I have moved my domain from one provider to another and after that zoho mail stopped working (expected). Problem is, zoho mail admin panel still shows (10 hours after move) that all records are correct while I haven't changed anything in my domain DNS
                                  • Add Support for Authenticator App MFA in Zoho Desk Help Center

                                    Hello Zoho Desk Team, We hope you are doing well. We would like to request an enhancement related to security for the Zoho Desk Help Center (customer portal). Currently, the Help Center supports MFA for portal users via SAML, JWT, SMS authentication,
                                  • Zoho Desk - Custom Module Related List Columns on Tickets

                                    I have a custom module in Zoho Desk called Asana Tasks, each task has a lookup to a Ticket. On the Ticket I want to see the columns of the Asana Tasks in the related list . Is there a way to do this? Right now it just has the name of the record and I
                                  • What is your opinion of the new UI?

                                    Hi Everyone, I would like to see what everyone thinks of the new Zoho One Dashboard. I don't get it, but perhaps I'm missing something. What are your thoughts?
                                  • How to unlink a SAML user from the existing Zoho Desk user (domain change case)

                                    Hi everyone, I’m trying to understand how to handle a situation where a customer changes their company domain. In our setup, users authenticate via SAML, so when the domain changes, the SAML system treats them as a new user. However, in Zoho Desk, I’d
                                  • Price Managment

                                    I have been in discussions with Zoho for some time and not getting what I need. Maybe someone can help explain the logic behind this for me as I fail to understand. When creating an item, you input a sales rate and purchase rate. These rates are just
                                  • Related to zoho survey

                                    Hi team. I want to know something regarding zoho survey question builder. I have two questions each of dropdown (One answer) - question type. In the first question, there are 16 answer choices and in the second question, there are 3 answer choices. For
                                  • Creator HTML page refresh

                                    Hi, I have added around 5 different html snippets in single creator page. I understand, I can refresh the entire page from page script using Navigational URLs https://help.zoho.com/portal/en/kb/creator/developer-guide/others/url-patterns/articles/navigational-urls
                                  • 60 Days Into Zoho - Tiktok Branding Startup -7 Questions?!

                                    Wsp Everybody I co-own a TikTok Branding / Consulting Startup & have been using Zoho for the past 60 days - Am now looking to make our overall operations & processes more Efficient & Effective! Curious to know how others are using the platform & what's
                                  • Text Message

                                    When trying to sent a text message, it says its an error i should contact a zoho agent
                                  • Zoho POS is now available for Canadian retailers

                                    Hey everyone, We're excited to introduce the all-new Canadian edition of Zoho POS, which helps retail businesses simplify and manage their end-to-end business operations. Start by signing up and exploring the 15-day free trial. Sign up now How does Zoho
                                  • Zoho CRM - Option to create Follow-Up Task

                                    When completing a Zoho CRM Task, it would be very helpful if there was an option to "Complete and Create Follow-Up Task" in the pop-up which appears. It could clone the task you are closing and then show it on the screen in edit mode, all the user would
                                  • Payroll In Canada

                                    Hi, When can we expect to have payroll in Canada with books 
                                  • Mass update to change or shift all project dates and keep project structure + shift all sub-tasks dates with main tasks

                                    Most users would expect that if they change the start date of their project then that will be reflected inside the actual project and any project structure would be retained.  Additionally if a task list with associated sub-tasks is moved, most users would expect that those sub-tasks would also be moved along with their parent task.  This is not the case. For a total Project shift of dates: * the start and end date from > "Edit Project" page can have a radio button added to "shift all project tasks
                                  • Closing Accounting Periods - Invoice/Posting dates

                                    Hi, I have seen in another thread but I'm unsure on how the 'transaction locking' works with regards to new and old transactions. When producing monthly accounts if I close December 24 accounts on 8th Jan 25 will transaction locking prevent me from posting
                                  • Next Page