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 

    Access your files securely from anywhere


            Zoho Developer Community




                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day



                                          Zoho Marketing Automation
                                                  • 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


                                                  Manage your brands on social media



                                                        Zoho TeamInbox Resources

                                                          Zoho DataPrep Resources



                                                            Zoho CRM Plus Resources

                                                              Zoho Books Resources


                                                                Zoho Subscriptions Resources

                                                                  Zoho Projects Resources


                                                                    Zoho Sprints Resources


                                                                      Qntrl Resources


                                                                        Zoho Creator Resources



                                                                            Zoho CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

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

                                                                                      Zoho CRM コンテンツ






                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方





                                                                                                  • Recent Topics

                                                                                                  • How manage to hardware and software contracts.

                                                                                                    So I have been tasked with setting up on crm a way of managing our software and hardware contracts. with a filter switch, so if they are no longer on say a hardware contract but still on a software, we would like the history about the hardware contract
                                                                                                  • Zoho Payments integration

                                                                                                    What are you going to get Zoho Payments integrated with Zoho Forms? It's kind of embarrassing to have several payment options... but not your own, which has been out for quite a while.
                                                                                                  • Its 2022, can our customers log into CRM on their mobiles? Zoho Response: Maybe Later

                                                                                                    I am a long time Zoho CRM user. I have just started using the client portal feature. On the plus side I have found it very fast and very easy (for someone used to the CRM config) to set up a subset of module views that make a potentially extremely useful
                                                                                                  • BIN Locations

                                                                                                    Hi, I’m new to Zoho inventory and unless Im missing something, I cannot find BIN locations anywhere in ‘items’? please tell me it’s there somewhere?!? Thanks
                                                                                                  • Automation Webinar Recording

                                                                                                    Hello developers, As we mentioned in our previous post, we've created the Zoho Finance Developer community to help developers learn, share ideas, and solve various business challenges related to the Zoho Finance apps. As the first step of this initiative,
                                                                                                  • Integrate MS Teams with Zoho CRM for faster collaboration

                                                                                                    Availability Editions: Standard and above DCs: All Release status: This feature has been released for all users in all DCs. Help resource: Microsoft Teams integration Hello everyone, We're adding MS Teams to our lineup of CRM chat integrations—Cliq, Slack,
                                                                                                  • Announcing new features in Trident for Windows (v.1.20.4.0)

                                                                                                    Hello Community, Trident for Windows is here with some new features to elevate your work experience. Let's take a quick look at what's new. Export emails. You can now export emails in the .eml file format as compressed zipped files to create a secure
                                                                                                  • Related list Mobile Device

                                                                                                    Hello, We use an the Zoho creator application to make reports linked to Accounts. On the computer: it's easy to go the Account and see all the created reports in the related list below On iPad/Phone ZOHO CRM APP: we cannot see the reports on those accounts
                                                                                                  • Getting Data into zoho calendar from a creator app

                                                                                                    So how do you get a date that's created in an app, for example when a site visit is due, into the zoho calendar for the field engineers.
                                                                                                  • [Free webinar series] Get to know Deluge: Zoho’s powerful scripting language

                                                                                                    Hello Everyone, We are much elated to invite you all to our upcoming session in Zoho Deluge! Bringing on to your table - Get to know Deluge: Zoho’s powerful scripting language Understanding Deluge Zoho’s suite of applications offers robust solutions for
                                                                                                  • Can I Integrate ADP Payroll with Zoho Books?

                                                                                                    Hi, I am hoping that I can integrate ADP Payroll with Zoho Books so that I do not need to manually input the payroll journal entries. Is this possible? If so, how do I do that?
                                                                                                  • Currency Field Does Not show commas upon entry - leading to inaccurate entries!

                                                                                                    Hello Zoho.. When our sales reps are entering deals and the profit/revenue it is difficult to accurately enter numbers with lots of zeros when there commas are NOT added until the record is saved. Could commas be added to this filed type as it is being
                                                                                                  • Portal orders

                                                                                                    Is it possible to set up an ordering system through the portal so that my customers can place orders through their portal?
                                                                                                  • Simplify Zoho API integration with Deluge’s invokeAPI task

                                                                                                    Hello all! Happy New Year! As we kick off 2025, we’re excited to share some of the latest updates to enhance your Deluge experience. While Deluge already offered robust API integration capabilities, we’ve taken it to the next level with the introduction
                                                                                                  • Default account for service invoice

                                                                                                    Hello, My client has some invoices for which he has entered a service description rather than using an item.  Is there a way to set the income account on this invoice, or can that only be done by using an item?
                                                                                                  • Issue with Missing Email on Reply or Forward

                                                                                                    مرحبًا بفريق دعم Zoho، أواجه مشكلة مع Zoho Mail. عند الرد على بريد إلكتروني أو إعادة توجيهه، لا تظهر الرسالة الأصلية أو البريد الإلكتروني المرسل بشكل طبيعي للمستلم. بدلاً من ذلك، يتم عرض رمز ثلاثي النقاط، ويتعين على المستلم النقر فوقه لعرض البريد الإلكتروني
                                                                                                  • Recommendations to store meeting notes for easy access from Contacts, Accounts & Deals module records?

                                                                                                    I would like your advice on how to achieve this use case for my organization. It’s related to where/how best to store meeting notes from a conversation with Contact(s) working at an Account (Company) in the context of a Deal. The ideal solution (from
                                                                                                  • Editing data in Related List tables

                                                                                                    Hi, we have a related list table showing many quotes on our Client record. At present, we have to edit each quote record by entering each record and then going back to the Client record. Is there a way to edit the various fields shown in the related list
                                                                                                  • ssue with Zoho Mail – Original Email Not Displayed Properly in Replies or Forwarded Emails

                                                                                                    Hello Zoho Support Team, I am experiencing an issue with Zoho Mail. When replying to or forwarding an email, the original message or the sent email does not appear normally to the recipient. Instead, a three-dot icon is displayed, and the recipient has
                                                                                                  • Simplify Zoho API integration with Deluge’s invokeAPI task

                                                                                                    Hello all! Happy New Year! As we kick off 2025, we’re excited to share some of the latest updates to enhance your Deluge experience. While Deluge already offered robust API integration capabilities, we’ve taken it to the next level with the introduction
                                                                                                  • Free webinar: Simplifying small business paperwork with Bigin and Zoho Sign

                                                                                                    As a Zoho Sign user, you already know the value of digital signatures. But did you know you can improve your document signing and management by integrating with Bigin, the easiest CRM for your business? We're hosting a free webinar on Jan 29, 2025 (Wednesday)
                                                                                                  • Tracking Emails sent through Outlook

                                                                                                    All of our sales team have their Outlook 365 accounts setup with IMAP integration. We're trying to track their email activity that occurs outside the CRM. I can see the email exchanges between the sales people and the clients in the contact module. But
                                                                                                  • How to create Sepa Direct Debit XML file: solution and code

                                                                                                    Even though Books provides a payment integration for Stripe and Gocardless (in Europe) there are customers that want to use the Sepa services of their own bank. Mainly because Stripe and Gocardless are quite expensive. In that case they would need a Sepa
                                                                                                  • CASE Module - email function

                                                                                                    HI there, I dont know if this has been asked or answered before as i couldnt find it on the forums. Issue: when a new case is raised, it goes under case tab and everything is captured. Then how do i send emails to the client who raised case with the details
                                                                                                  • This domain is not allowed to add. Please contact support-as@zohocorp.com for further details

                                                                                                    I am trying to setup the free version of Zoho Mail. When I tried to add my domain, theselfreunion.com I got the error message that is the subject of this Topic. I've read your other community forum topics, and this is NOT a free domain. So what is the
                                                                                                  • Automate pushing Zoho CRM backups into Zoho WorkDrive

                                                                                                    Through our Zoho One subscription we have both Zoho CRM and Zoho WorkDrive. We have regular backups setup in Zoho CRM. Once the backup is created, we are notified. Since we want to keep these backups for more than 7 days, we manually download them. They
                                                                                                  • Enhanced duplicate check for Leads in CRM

                                                                                                    Hello Everyone, We are excited to announce that you can now check for duplicate entries in leads by comparing them with similar records in the Contacts Module. Previously, when you added a lead, only the converted leads were checked for duplicates. This
                                                                                                  • remove one field

                                                                                                    we want to remove compensation amount field from our offer letter,As we are hiring interns we don't want compensation amount.
                                                                                                  • Context and convenience just got better with Zia's email intelligence

                                                                                                    Dear Customers, We hope you're well! We are in 2024, and email as a tool is only getting more powerful each day. While it enables seamless daily correspondences, we are here with a set of abilities that will enhance your user experience and save several
                                                                                                  • Bounced Emails

                                                                                                    Hello, Is there any chance we could have an alert for bounced emails in Recruit. This functionality is available in Zoho CRM. It would be really useful to be able to see at a glance who's messages have bounced back.
                                                                                                  • Images Added as Attachments to Email

                                                                                                    Hello, I am not sure if I am doing something wrong, but I am new to Zoho CRM.  I just created my first email template that contains about 5 images.  When I test out the email, it includes each of the images as an attachment to the email. Is there a way to remove this functionality/feature so that the images are shown in the email, but are not also included as attachments?   Thanks in advance.   Jo-Ann
                                                                                                  • Formula fields - Request for dynamic recalculation / proper implementation

                                                                                                    Hi Guys, I have a big problem with Zoho formula fields. They don't recalculate each time the record is viewed - only when a record is edited. Formula fields should be updated dynamically each time a record is retrieved. As an example: I have a formula
                                                                                                  • Using LinkedIn to generate contact/company information

                                                                                                    Hi, we are currently in the process of implementing Bigin. One thing we really miss is a functionality that automatically generates contact or company information based on an email address or name/address. Before switching to Bigin, we were using Teamleader,
                                                                                                  • How can I visualize the events of a pipeline records?

                                                                                                    Hi I need a list of events, including the date and address of the event related to the pipeline record. Can I do that? I know that for every pipeline record I can create events associated (Tasks, events, calls). But what I need it is an easy way to get
                                                                                                  • Caso de Uso | Fermax omnicaliza su atención al cliente con Zoho Desk

                                                                                                    “Zoho Desk nos ha permitido gestionar la omni-canalidad. Ahora nuestros clientes puedan comunicarse con nosotros desde cualquier plataforma", José María Vázquez, CTO de Fermax. ¡Hola, Español Zoho Community! Sabéis que nos encanta compartir cómo otros
                                                                                                  • Zoho Creator HTML Snippet - Can't get list to iterate

                                                                                                    Hi! I'm trying to create an HTML Snippet on a page in Zoho Creator and would like to create an HTML table pulled from a list of time entries that I have in a form. I have successfully pulled the collection of time entries, but the code that I have built
                                                                                                  • Issue with Exact Phone Number Match in Zoho CRM Search Record API

                                                                                                    Hello Everyone, I am working on a custom function that works as a REST API. This function receives API calls via a third-party webhook, where the payload data contains various details, including phone numbers, names, dates, etc. A single payload can contain
                                                                                                  • Ticket owner for desk ticket can't be set using Zapier "Create ticket" function.

                                                                                                    I have a step in my zap where I create a ticket in desk, everything works fine apart from setting the Assignee (Ticket owner in desk). When I look at the data sent to the API the assignee variable has no data I can set the assignee (Ticket owner) if I
                                                                                                  • Form to update a CRM contact field

                                                                                                    Hello I need an help as I am going crazy. I need to create a form where there is a dropdown field with the contacts of Zoho crm (if possible filtered on the base of a field) and where other fields will be be automatically fetched with zoho crm data as
                                                                                                  • How to Automatically Populate the Deal ID in the Parent Lead After Creating a New Deal with Blueprint?

                                                                                                    Hello Everyone! 🎉 I wanted to share a solution to a problem that some of you might have encountered. In Zoho CRM, when creating a Deal from a Lead using a Blueprint, data can only flow in one direction—from the Lead (parent) to the Deal (child). But
                                                                                                  • Next Page