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.
12. Enter a Name and Description for the custom function.
                                         
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;
Notes
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 Edit Arguments and include the argument mapping as below: 
      14.1 In the Name field, type ticketId and from the Value drop-down list, select Ticket Id under the Tickets Section.
15. Click Save to save the custom function.
16. 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

      Zoho Desk Resources

      • Desk Community Learning Series


      • Digest


      • Functions


      • Meetups


      • Kbase


      • Resources


      • Glossary


      • Desk Marketplace


      • MVP Corner


      • Word of the Day


        • Sticky Posts

        • Zoho Desk Virtual Meetup: US Central, October 5 - 7, 2021

          After the interactive Virtual Meetups in the other regions, we are starting with the US Central and Midwest regions from October 5 to October 7, 2021. The dates for other regions will be announced soon.  At this event, we will explore the topics which
        • 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
        • Ask the Experts 10: A 5-hour online Q&A on Zoho Desk Best Practices

          Welcome to Zoho Desk's Ask the Experts session! This is a monthly discussion on our  forums; wherein a panel of experts will take on questions  specific to topics related to Zoho Desk. The panel will be available for a 5-hour period and will answer any questions posted here.   Let's begin the year learning some best practices from our experts. In this month's ATE we are opening the floor to questions on how to use Zoho Desk the best way.  If you have a business use case but not sure if Workflow is
        • 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. 
        • Ask the Experts 7: A 5-hour online Q&A on Telephony and Call Module

          Welcome to Ask the Experts session! This is a monthly discussion in forums; each session, a panel of experts will take questions on specific topics related to Zoho Desk. The panel will be available for a 5-hour period and answer any questions posted here. In this month's Ask the Experts, we will take questions on everything related to Telephony and the Call Module in Zoho Desk. We will discuss the following aspects:  Integration with different Telephony vendors Routing calls to agents Converting

        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

                                • Customer Statement Template

                                  Hi. how can i add order number "customer LPO number" in the customer statement. regards
                                • Linking an email to a Contact when the email is sent in deluge via sendmail

                                  The "to:" address in this code is a CRM Contact. Email address is forced unique in CRM This sendmail gets sent via a workflow which is in a custom module. It works, except that the outbound email does not appear (i.e, get linked to) the Contact such that
                                • Introducing Bot Filtering for Accurate Email Campaign Analytics

                                  Dear Marketers, We're excited to announce a new feature designed to enhance the accuracy of your email campaign analytics: bot filtering. This feature helps you filter out bot-generated opens and clicks, ensuring your campaign reports reflect genuine
                                • Edit HTML of forms? Add autocomplete="off"?

                                  Recently I've noticed that something — one customer suggested it was Chrome — is auto-filling one of my form fields with the customer's address. The field is a textarea that has nothing to do with the address — it's just a comment field. I'd like to be
                                • All notes disappeared

                                  I've been using the notebook app for over five years on my phone without being logged into an account. A few days ago I opened the app and all my notes had disappeared. Since then I tried restarting my phone, updating the app and logging into my account,
                                • Function 56: Automatically enable the option for customers to pay via bank account

                                  Hello everyone and welcome back to our series! One of the key features of Zoho Books is its integration with multiple payment gateways, allowing you to receive online payments for your invoices. This ensures faster payments, automates payment tracking
                                • Issues hosting Zoho Desk Web Form on SharePoint and/or Power BI

                                  Zoho Desk onboarding support has no experience with embedding their web form in either SharePoint or Power BI. Microsoft states that SharePoint and Power BI only support iframe HTML. And unfortunately, the web form embed code that Zoho generates is not
                                • Standalone function is not working

                                  Hi, We have created a standalone function to integrate with a third-party service using OAuth. However, the standalone function's REST API key is expiring automatically after some time. When we regenerate the API key from the admin account, the function
                                • Zoho Visual Editor Not Opening

                                  Hello There I am trying to build a website using zoho and I can't open the visual editor. It keep saying Loading...  Do you know why it is happening. Thanks in Advance Regards Rajat
                                • Function went from fine to nonfunctioning without change

                                  url = "https://www.zohoapis.com/crm/v7/Accounts/" + id + "/Attachments/" + attach_id; file_engage = invokeurl [ url :url type :GET connection:"zoho_attachments" ]; The attach id is grabbed from a file upload field account = zoho.crm.getRecordById("Accounts",id);
                                • Can I give access of my Zoho Spreadsheet?

                                  Hello Everbody! I work with a travel and tourism company, and my job is to record the data of clients of the company. And I use zoho for my work. So my question is can I give access of my sheet to the clients and my company. Kindly guide me. Thankyo
                                • Syncing Fields Between Accounts AND Deals

                                  Please don't email me, I will check this thread for updates daily. I have a custom set of 10 fields (CFSET) in my account pages and deals pages. I want to fill them out on accounts pages per each, then when I make a new deal in an account, I want to copy
                                • Domain verification is in progress... (How long do I need to wait?)

                                  Trying to setup my first email domain by connecting with GoDaddy. Have been here for quite some time and the screen is not changing. How long should this take?Send DataSend Data
                                • This mobile number has been marked spam. Please contact support.

                                  Hi Support, Can you tell me why number was marked as spam. I have having difficult to add my number as you keep requesting i must use it. My number is +63....163 Or is Zoho company excluding Philippines from their services?
                                • Unable to send message;Reason:553 Relaying disallowed. Invalid Domain

                                  Team, When i try to send mail through ZOHO mail i am getting the following error. "Unable to send message;Reason:553 Relaying disallowed. Invalid Domain" Can i get some help on this. Thanks
                                • Zoho mail stopped receiving emails

                                  My Zoho email addresses that are linked to a domain suddenly stopped receiving messages yesterday, even though I've been using Zoho mail without problems for 1,5 years. I receive this reply to test emails: "553 Relaying disallowed". Due to this, my SMTP
                                • Email client fails to connect to IMAP & POP EU Servers for ALL users

                                  For the last couple of days, all users on my account are failing to connect to the Zoho EU mails servers. This is using mobile app on various phones & desktop mail clients on different computers. Everything works fine when using webmail & email is still
                                • Zoho Project API search?

                                  Good day, i would like to search our entire portal for a task using the API. We have over 20k tasks so I dont to search for all tasks and then do a for each as it would take way to long and also would need to go over the limit of 200 records per query.
                                • My email client shows no emails anymore

                                  I let my account expire due to old payment method. I repurchased it I turned back on IMAP Then all my emails disapeared. Everything is fine in the webview and and zoho mail app
                                • Invalid Domain

                                  Team, When i try to send mail through ZOHO mail i am getting the following error. "Unable to send message;Reason:553 Relaying disallowed. Invalid Domain" Can i get some help on this. Thanks
                                • URGENT - Issue with outgoing mail

                                  I am receiving mail but atm can not send - and not being given any code/reason as to why?
                                • Impossible d'envoyer un message :Raison :553 Relaying disallowed. Invalid Domain - masertech.ma

                                  Bonjour, J'ai renouvelé mon abonnement mais j'ai le probleme de domain.
                                • Email SPF Hard Fail

                                  Hi, can you help me to understand why email rejected? Paste error: This is the mail system at host pdx1-sub0-mail-mx206.dreamhost.com. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.
                                • Can I export to PDF in Zoho Learn

                                  I have seen help pages where export to pdf options are available but I do not see that option available from the application. I see that exprt is available in my free trial version but that is only to html pages. I need to be able to export my manuals
                                • COQL equivalent to zoho.crm.getRelatedRecords

                                  Hello i add a standalone function, that i call from my js app with ZOHO.CRM.CONNECTION.invoke etc in the function i fetch with something like this AllContacts = zoho.crm.getRelatedRecords("relation_name","parent_module_name",recordid); it works great
                                • Add option "Avoid custom home pages" to profiles

                                  We need our sales agents and members on each department in general to keep the same Home designed by their Managers. Let all users to create custom home pages is a huge mistake. The homepage creation must be limited by profile so only Managers are allowed
                                • why is zoho assist server so slow

                                  Hello why is zoho assist server so slow, i use it every and and have fast speed at either end of the connection but zoho assist take upto 10 seconds per click, I connect on the chat they we will have a look and come back saying they have done a reset
                                • WHEN UPDATE ORGANIZATION INFO OLD INVOICES ALSO CHANGE INVOICING DATA

                                  Hi We have updated our tax information because we have become a company, up until now we were an individual. The problem is that when updating the data in the zoho books profile all the old invoices change their tax information as well. Is there a way
                                • DELETE EU VAT ID FORM MY ACTUAL INVOICE ADDRESS FROM MY ACCOUNT

                                  WE NEED TO DELETE (NOT CHANGE) THE EU VAT ID FROM OUR INVOICE ADDRESS. WHEN WE TRY TO LEFT IT BLANNK, AGAIN SAVE THE OLD EU VAT ID. YOU ARE SENDING US FALSE INVOICES WITH FALSE DATA
                                • Enable Timesheet for Client Users

                                  In Zoho Projects, the client users can log work hours in timesheets and track the time spent on tasks and issues. This permission can be enabled only by the portal owner or the admin. For instance, If the administrator wants a client user to add the time
                                • Possible to delete the "Big Deal Alert" in Zoho CRM?

                                  Hi, Is it possible to delete the "Big Deal Alert" in Zoho CRM? My company has no need for it and I want to remove it to clean up my email templates list. Thank you.
                                • How to Create and Edit Advances in Zoho Expense Using Deluge?

                                  Hi everyone, I am working with Zoho Expense and need to manage Advances (Advance Payments) using Deluge. I’ve familiarized myself with some basic functions, but I have specific questions about how to create and edit advance records: Creating Advances:
                                • ¿Cómo publicar mi pagina web zoho?

                                  Arme una pagina web en zoho, al querer publicarla seguí los pasos y pulse en publicar, pero no se publico. Ya pasaron 2 días. podían ayudarme.
                                • What's New in Zoho Analytics - December 2024

                                  Hello Users! We’re excited to bring you a roundup of the latest features and improvements in Zoho Analytics. These updates are designed to elevate your data analytics experience, making it more powerful, interactive, and seamless. Let’s dive in! Expanded
                                • Setting default From address when replying to request

                                  At the moment, if I want to reply to a request, the From field has three options, company@zohosupport.com, support@company.zohosupport.com, and support@company.com.  The first two are really internal address that should never be seen by the customer and
                                • Zoho Sheet View

                                  Hello, Is there a way to either customize the columns that appear in Zoho Sheet View, or else show all columns?
                                • For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account.

                                  Hello Zoho Even if we open 10-15 windows in still we are getting our accounts locked with error " For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account. "
                                • Sharing sheet without affecting original spreadsheet

                                  I want to share a sheet using a password unique to the end user who will be able to enter data that will help them make a decision. I don't want or need any changes to show up to original file inside my Zoho account. I will be sharing this sheet over
                                • How do you re-order (sort) the order of articles in a chapter?

                                  So you can re-order Chapters but I cannot see where and how to re-order the Articles within each Chapter... Surely this is possible?
                                • Recurring Events Not Appearing in "My Events" and therefore not syncing with Google Apps

                                  We use the Google Sync functionality for our events, and it appears to have been working fine except: I've created a set of recurring events that I noticed were missing from my Google Apps calendar. Upon further research, it appears this is occurring
                                • Next Page