Kaizen 188 - Building a Timer and Worklog Widget (Part 2)

Kaizen 188 - Building a Timer and Worklog Widget (Part 2)



Welcome back, Tech Wizards!

In Part 1, we developed a Timer Widget that logs active work sessions into the Timer Entries module. 

Now, let's enhance this functionality by transferring these entries into the Work Log subform within the Cases module using a workflow with Deluge function and APIs. We will also explore how to generate insightful reports from the Timer Entries module data.

Here is a consolidated view of the outcomes we aim to achieve through these sequential posts.



The following data model illustrates the modules and subforms involved in this use case to help you understand the structure more clearly.


Learn more about the Data Model and how it helps to simplify the understanding of complex processes.

Auto-Syncing Timer Entries to Case Work Logs

For automating the data transfer from the Timer Entries module to the Work Log subforms within Cases module, we will create a workflow rule with an instant action defined in Deluge function. 

Prerequisites

Create a subform named Work Log in the Cases module with the following fields. 

Field Name
Data Type
Actual Time Taken(in mins.)
Aggregate

(sum of Total Duration (in mins.) field in related case )
End Time
DateTime
Related to Case
Lookup to Cases
Related to Current Case
Checkbox
Start Time
DateTime
Timer Entry
Lookup to Timer Entries
Total Duration
Aggregate 

(sum of all the Total Duration (in mins.) field )
Total Duration (in mins.)
Number
Work Description
Multi Line

Follow the Building a Subform and  Working with Custom Fields help pages for creating the subform and fields in Zoho CRM UI, or you can also make Post Custom Fields API calls to create the custom fields in the subform. 

Step 1: Create a Workflow

  • Login to your Zoho CRM and go to Setup > Automation > Workflow Rules and click Create Rule.
  • Choose the Timer Entries module from the dropdown. Provide name and description for the workflow rule.
  • In the 'When' section of the workflow, choose the trigger as Record Action. In record action, define the trigger as when the End Time field is modified to any value. 
  • In the 'Condition' section, choose all timer entries. In the 'Instant Actions' section, select Function and choose Write your own

Step 2: Create a Deluge Function

  • In the pop box that appeared after choosing to write your own function. Fill in the following details as shown in the image and click Create.
  • A code editor will open, where you have to define the data transfer logic in Deluge. 

Code logic

The UpdateDataInWorkLog function automates the process of syncing a completed Timer Entry with its associated Cases in Zoho CRM by populating the Work_Log subform for each case.

Fetches Target Case Records

The function uses a predefined custom view (cvid) that we created in Part I of this post to retrieve a list of Case records that are eligible for update. It extracts their record IDs and prepares them for bulk processing.

paramMap = Map();
paramMap.put("cvid","5545974000011183885");
getRecordsResponse = invokeurl
[
type :GET
parameters:paramMap
connection:"crm_oauth_connection"
];
responseDataArray = getRecordsResponse.get("data");
idList = List();
for each  item in responseDataArray
{
idList.add(item.get("id"));
}
caseRecordsToUpdate = idList;

Retrieves Timer Entry Details

The selected Timer Entry (identified by recordId received through workflow trigger) is fetched to extract its key details like, Start and end times, Total time spent (duration), Work description, the Case it’s directly related to (if any).

record = zoho.crm.getRecordById("Timer_Entries",recordId,Map(),"crm_oauth_connection");
startTime = record.get("Start_Time");
endTime = record.get("End_Time");
totalTime = record.get("Total_Duration");
workDescription = record.get("Work_Description");
relatedToCaseId = "";
if(record.get("Related_to_Case") != null)
{
relatedToCaseId = record.get("Related_to_Case").get("id");
}

Prepares Work_Log Subform Entries

For each retrieved Case, a new subform entry is created in the Work_Log subform. This entry contains the time details, work description, and a reference to the Timer Entry. A flag (Related_to_Current_Case) marks whether the Timer Entry is directly associated with the Case.

caseRecordIds = caseRecordsToUpdate;
if(!caseRecordIds.isEmpty())
{
recordUpdateArray = List();
for each  caseRecordId in caseRecordIds
{
TimerArray = List();
TimerObj = Map();
TimerObj.put("Work_Description",workDescription);
TimerObj.put("Timer_Entry",recordId);
TimerObj.put("Related_to_Case",relatedToCaseId);
TimerObj.put("Start_Time",startTime);
TimerObj.put("End_Time",endTime);
TimerObj.put("Actual_Duration_in_mins",totalTime.toNumber());
info totalTime;
TimerObj.put("Related_to_Current_Case",caseRecordId == relatedToCaseId);
TimerArray.add(TimerObj);
recordUpdateObj = Map();
recordUpdateObj.put("id",caseRecordId);
recordUpdateObj.put("Work_Log",TimerArray);
recordUpdateArray.add(recordUpdateObj);
}

Bulk Updates Case Records

All Case records are updated in bulk via the Update Records API. Each gets its Work_Log subform updated or appended with the latest Timer Entry details.

updateRequestBody = {"data":recordUpdateArray};
updateResponse = invokeurl
[
type :PUT
parameters:updateRequestBody + ""
connection:"crm_oauth_connection"
];
}

Once done, click Save and associate the merge field (Timer Entry ID) with the function.


This workflow is triggered when the timer widget is stopped and the end time is updated in the corresponding timer entry record. 

Following is a GIF that illustrates how the data sync reflects in the case records.

Generating Reports from Timer Entries

With the Timer Entries and Work Log data in place, you can create comprehensive reports to analyze work patterns, SLA adherence, and productivity trends.
  1. Navigate to the Reports module and click Create Report.
  2. Choose Cases as the primary module and include the Work Log subform.
  3. Select the desired fields like Case Subject, Start Time, End Time, Total Duration, and Work Description. 
  4. Group data by fields like Case Owner or Status to gain insights into workload distribution and case progress.
  5. Apply filters as needed, such as date ranges or specific case statuses.

Refer to the Understanding and Building Report help page for more details. 

With the Timer Widget, automated data transfer to Work Logs, and insightful reporting, we have established a robust system to track and analyze multiple active work times within Zoho CRM.

If you have specific scenarios or challenges you'd like us to address in future Kaizen posts, feel free to share them in the comments or reach out to us at support@zohocrm.com.

Cheers!

------------------------------------------------------------------------------------------------------------------

Additional Reading 

------------------------------------------------------------------------------------------------------------------

    • Sticky Posts

    • Kaizen #197: Frequently Asked Questions on GraphQL APIs

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Kaizen #198: Using Client Script for Custom Validation in Blueprint

      Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Celebrating 200 posts of Kaizen! Share your ideas for the milestone post

      Hello Developers, We launched the Kaizen series in 2019 to share helpful content to support your Zoho CRM development journey. Staying true to its spirit—Kaizen Series: Continuous Improvement for Developer Experience—we've shared everything from FAQs
    • Kaizen #193: Creating different fields in Zoho CRM through API

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Client Script | Update - Introducing Commands in Client Script!

      Have you ever wished you could trigger Client Script from contexts other than just the supported pages and events? Have you ever wanted to leverage the advantage of Client Script at your finger tip? Discover the power of Client Script - Commands! Commands
    • Recent Topics

    • Feature Request - Insert URL Links in Folders

      I would love to see the ability to create simple URL links with titles in WorkDrive. or perhaps a WorkDrive extension to allow it. Example use case: A team is working on a project and there is project folder in WordDrive. The team uses LucidChart to create
    • Try FSM again for our business

      We already have our customers individual equipment in CRM with serial numbers, install dates, warranty length and importantly next service which is generally 2 years. a month before the service date is due we get get a report and send out service reminders.
    • GST Slabs Redefined: Stay Compliant Using Zoho Books!

      Hello Everyone! The Government of India is rolling out new GST rates, a major reform aimed at simplifying the current tax structure starting 22 September 2025. GST will move from four slabs (5%, 12%, 18%, 28%) to two main slabs (5% and 18%), plus a special
    • Zoho CRM button to download images from image upload field

      Hello, I am trying to create a button in Zoho CRM that I can place in my record details view for each record and use it to download all images in the image upload fields. I tried deluge, client scripts and even with a widget, but feel lost, could not
    • Get Cliq Meetings in my O365 calendar

      Hi, we are currently evaluating to replace the Teams Messaging and Meetings with Cliq. We currently still have all our email and calendars in O365. What i want to achieve is, to create a (ZOHO) meeting from Cliq and have this meeting added to my Outlook/O365
    • Issue with Zoho Help Portal – Tickets Missing or Not Answered

      Hi, How are you? I think there may be an issue with the Zoho Help Portal. I opened a few tickets directly in the help portal a some time ago but never received any response I also opened ticket 148356451 by email. I did receive a reply to it, but the
    • Changing the Default Search Criteria for Finding Duplicates

      Hey everyone, is it possible to adjust the default search criteria for finding and merging duplicate records? Right now, CRM uses some (in my opinion nonsensical) fields as search criteria for duplicate records which do nothing except dilute the results.
    • 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
    • access to quartz for my customers

      Hi how can I have access to the application quartz you use for us to send you screen rocording, this feature would be immensely useful for our customers support https://quartz.zoho.com/
    • DUNS & Bradstreet and Credit risk monitoring integration with Zoho books

      Small businesses not being paid by bigger clients and clients of all sizes is a huge problem. It will be nice if Zoho develops integration with DUNS & Bradstreet(D&B) and Credit risk monitoring integration with Zoho books. That have small businesses can
    • Filtering Tickets based on Email headers

      We're starting to get a lot more junk coming into our Zoho Desk, which is then triggering unnecessary email alerts to agents. Once thing we could do to cut this junk in half, is to filter tickets based on email headers. Any email containing the `List-Unsubscribe`
    • Zoho Forms - Form Rules based on attachment fields

      Many businesses use forms to collect documents and images from customers. In many cases, you may want to trigger a notification or other automation based on whether or not an attachment was added. I've noticed that attachment fields do not appear in Rules
    • Add QUOTE OWNER profile image to a Quote Template

      I can add their email address.. phone number, DOB. I need to add a users profile picture so when they assign a template to a quote they own it adds their picture to the cover page. I've tried hacking a solution together but there has to be an easier way.
    • Elevate your CX delivery using CommandCenter 2.0: Simplified builder; seamless orchestration

      Most businesses want to create memorable customer experiences—but they often find it hard to keep them smooth, especially as they grow. To achieve a state of flow across their processes, teams often stitch together a series of automations using Workflow
    • New in Cadences: Option to Resume or Restart follow-ups when re-enrolling records into a Cadence, and specify custom un-enrollment criteria

      Managing follow-ups effectively involves understanding the appropriate timing for reaching out, as well as knowing when to take a break and resume later, or deciding if it's necessary to start the follow-up process anew. With two significant enhancements
    • No Response from Zoho Support in 8 Days - Typical?

      I have a couple of issues I'm trying to work through. Initially, I was getting support from support@zohofsm.com, but I have not received a response in 8 days (11 on another question). Is this typical? Can I pay for support? For context, I am not spamming
    • Office 365 and CRM mail integration: permission required

      Has anyone run into this weird problem? My email server is Office 365. When I try to configure Zoho CRM to use this server, a Microsoft popup window opens requesting user and password. After entering that, I get a message in the Microsoft window saying
    • Age Calculation

      I've attempted to calculate the age of someone based on their birthday input by using the formula field. It works but I don't want all those decimals on there. I then tried to use "set variable" after birthday input but I get a field type mismatch, long vs. floating. Any ideas would be wonderful.
    • 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,
    • Change scheduling emails time

      When sending an individual email there is a great feature to schedule them to send later. I could only use the one time that is suggested. Is there a way to select another time? Regards, Glenn
    • Zoho CRM: how can I control which contacts to sync with Outlook?

      I was just playing around syncing contacts from Zoho to MS Outlook (MS365 account.) The problem is our firm has hundreds of thousands of contacts and I don't want to bury my contacts list in outlook. Any help with this is greatly appreciated.
    • How to overcome limitations in meetings

      As a company, one of our deliverables is a meeting between two other companies, where we act as facilitators. So, if we recorded this meeting  in Zoho CRM, it should be connected to 2 accounts, 2 contacts, and 1 campaign (a campaign, in our use, is the
    • Different MRP / Pricing for same product but different batches

      We often face the following situations where MRP of a particular product changes on every purchase and hence we have to charge the customer accordingly. This can't be solved by Batch tracking as of now so far as I understand Zoho. How do you manage it as of now? 
    • Add a 'Log a Call' link to three dot icon in Canvas

      Hi, There's a three dot element when creating a canvas called 'More'. I would like to modify this to add a link that says 'Log a Call' in order to quickly record the details of a cellphone call. I'd also like this to be a simple 'contact' selection and
    • Syncing Zoho Forms with Bigin - Embedding issue?

      Hello everyone, I created a Zoho Form for a page on my GoDaddy website to collect leads, which then transfers the data to Bigin. However, I'm facing an issue where it doesn't seem to work properly. I've integrated Zoho Forms with Bigin and tried embedding
    • Can not add fields to a Section

      I feel like I'm missing something obvious: I can add new Sections to my form but I can not add fields to the Sections. I've tried fields already on the form as well as dragging and dropping new fields into the Section but nothing will go into it. What
    • Record Logged in User while using CRM lookup field

      Is it possible, while using the Zoho CRM lookup field, to automatically use the user account logged into Zoho CRM in a hidden field? I was hoping to add employee accounts to my current plan. But would like a record on the Form submission of who submitted
    • Form Rules for Suburb Categories to alternate landing pages or Making a Fields Contents ALL CAPS

      I need to send differentform submissions to two to three different thank-you URLs (for Meta/Google pixels) depending on which suburb a user selects in a form. I have ~400 suburbs split into two categories (A and B, based on business value). Current challenges:
    • how to differentiate if whatsapp comes from certain landing page?

      I create a Zobot in SalesIQ to create a Whatsapp bot to capture the lead. I have 2 landing pages, one is SEO optimized and the other want is optimized for leads comes from Google Ads. I want to know from which landing page this lead came through WhatsApp
    • Collaps Notes

      There are times when long/large notes are added to a record i.e. Accounts or Deals etc. Currently, the full note is displayed in the notes related list section. It would be great if by default only 5 to 10 rows of the note are displayed when the note
    • Zoho Down

      I have a drop in my Zoho One services.
    • Runing RPA Agents on Headless Windows 11 Machines

      Has anyone tried this? Anything to be aware of regarding screen resolution?
    • Problem for EU users connecting Zoho CRM through Google Ads for Enhanced conversions

      Has anyone else experienced this problem when trying to connect Zoho CRM through Google Ads interface to setup enhanced conversions? Did you guys get it fixed somehow? The Problem: The current Google Ads integration is hardcoded to use Zoho's US authentication
    • Why am I getting event Pop-up Notification for events that have been cancelled?

      Why is Calendar Notification still popping up for events that have been cancelled or changed? Each time events are cancelled or changed, I have observed that I am still getting notifications for them. Below is a sample pop-up notification for one of the
    • Rich Text For Notes in Zoho CRM

      Hello everyone, As you know, notes are essential for recording information and ensuring smooth communication across your records. With our latest update, you can now use Rich Text formatting to organize and structure your notes more efficiently. By using
    • Whatsapp Limitation Questions

      Good day, I would like to find out about the functionality or possibility of all the below points within the Zoho/WhatsApp integration. Will WhatsApp buttons ever be possible in the future? Will WhatsApp Re-directs to different users be possible based
    • Issue with Inline Images in Email Reply via Zoho Desk API

      Hi, I am attempting to send inline images in an email reply using the Zoho Desk API, but the images are not being displayed inline for the recipient. I have followed this documentation: https://desk.zoho.com/DeskAPIDocument#Uploads https://desk.zoho.com/DeskAPIDocument#Threads#Threads_SendEmailReply
    • Create a draft in reply to an email via Emails API

      Hi, I’d like to use the outgoing webhook to automatically create a draft reply to incoming mail. How can I use the Emails API to create a draft reply that is linked to an existing email thread? I couldn’t find the relevant method in the documentation.
    • India Tech Support

      Is there no phone tech support number for India? And no chat facility either?
    • Billing Management: #1 Billing an Universal Business Routine

      Hello, As the saying goes, "Do the hardest job first", we started with the complex subject in finance, revenue management, which is considered to be the backbone for any business. Now, let's shift our focus and take a deep dive into this Billing Management
    • Next Page