
Hello Everyone,
Time tracking is a feature in Zoho Desk to help businesses stay organized and efficient. For Zylker Techfix, this feature has helped to track the duration of gadget services to generate accurate bills.
However, Zylker Techfix faced a unique challenge: they needed to round off time entries for precise billing calculations. Manually adjusting each entry was time-consuming and prone to errors. A simple custom function helped in auto-adjustments in time entry.
Zylker Techfix automated the process of rounding time entries to the nearest 5 minutes. This not only saved time but also ensured accuracy in their billing operations.
In this week’s post, we share this custom function with you!
Follow the steps below to set up your workflow rule and automate your time entries for seamless billing.
Prerequisites
1. Create a connection
1.1 Go to Setup(S) and choose Connections under Developer Space.
1.2 Click Create Connection.
1.3 Select Zoho OAuth under Default Connection.
1.4 Set the connection name as connection.
1.5 Under Scope, choose the below scope values:
Desk.tickets.UPDATE
1.6 Click Create and Connect.
1.7 Click Connect.
1.8 Choose the Desk's organization to connect with Deluge, and click Submit.
1.9 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 Time Entry 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 Create.
8. Click Next.
9. In the Criteria section, add criteria if required. click Next.
10. In the Actions section, click the + icon and select New next to Custom Functions.
11. Under Basic Information, Enter a Name and Description for the custom function. Choose Time Entry under Module.
12. Under Argument Mapping, give a desired Method Name. Map the arguments as below:
12.1 In the Argument Name field, type timeEntryId and select Time Entry Id under the Time Entry Section.
12.2 In the Argument Name field, type ticketId and select Ticket Id under the Time Entry Section.
12.3 In the Argument Name field, type minutesSpent and select Minutes spent under the Time Entry Section.
13. In the script window, insert the Custom Function given below:
- //---------- User Input ------------
- roundOffValue = 5;
- deskURL = "https://desk.zoho.com"; // Replace .com based on your DC
- //----------------------------------
- logs = Collection();
- reminder = minutesSpent % roundOffValue;
- minutesSpent = minutesSpent - reminder + roundOffValue;
- params = Map();
- params.put("minutesSpent",minutesSpent);
- params.put("secondsSpent",0);
- params.put("hoursSpent",0);
- updateTimeEntry = invokeurl
- [
- url :deskURL + "/api/v1/tickets/" + ticketId + "/timeEntry/" + timeEntryId
- type :PATCH
- parameters:params.toString()
- connection:"connection"
- ];
- logs.insert("updateTimeEntry":updateTimeEntry);
- info logs;
NOTE
In Line 3, Replace ".com" with the domain extension based on your Data Center.
14. Click Save to save the custom function.
15. Click Save again to save the workflow.
Point to Remember
This custom function rounds up the minutes in the Time Entry module. For example, 00:38:48 will be rounded up to 00:40:00, and 01:56:56 will be rounded up to 02:00:00.
We hope this custom function makes your time tracking smoother. We’d love to hear how this works for you! Share your feedback and connect with us for more tips and insights. Happy ticketing!
Regards,
Lydia | Zoho Desk