Power of Automation :: Automatically update the Work hours of a task based on Custom field Value

Power of Automation :: Automatically update the Work hours of a task based on Custom field Value

Hello Everyone,


A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate complex tasks and calculations. 


Lets take the below use case from a customer - 


They have created a custom field 'Task Type' at task level. Based on the value provided to that field, work hours should be automatically updated in that task. Below are the mappings between Task Type & Work Hours.


Task Type

Work Hours

AAIR

12 hours

Account Intel

32 hours

Competitor Intel

8 hours

Connects

8 hours

Custom Intel

9 hours

Deal Shortlisting

2 hours

IT Intel

4 hours

Priority Task

10 hours

Profiling

8 hours

Quarterly Analysis

16 hours

Win Loss

8 hours


This can be accomplished using the below code. Create a connection using the scopes “ZohoProjects.portals.READ, ZohoProjects.tasks.ALL, ZohoProjects.timesheets.READ” and update the connection name ‘******’ in the below code. Find the attached screenshot of the Arguments.

Here is the link to know how to create a connection.

// scopes: ZohoProjects.portals.READ, ZohoProjects.tasks.ALL, ZohoProjects.timesheets.READ

workhourMapping = Map();
workhourMapping.put("AAIR", 12);
workhourMapping.put("Account Intel", 32);
workhourMapping.put("Competitor Intel", 8);
workhourMapping.put("Connects", 8);
// workhourMapping.put("Custom Intel", Yet to decide);
workhourMapping.put("Deal Shortlisting", 2);
workhourMapping.put("IT Intel", 4);
// workhourMapping.put("Priority Task", Yet to decide);
workhourMapping.put("Profiling", 8);
workhourMapping.put("Quarterly Analysis", 16);
workhourMapping.put("Win Loss", 8);
if(taskType==null || !workhourMapping.containKey(taskType)) {
return "Task type is empty or map doesn't contain the specified task type";
}
else {
taskResponse = zoho.projects.getRecordById(portalId,projectId,"Tasks",taskId,"projects");
owners = taskResponse.get("tasks").get(0).get("details").get("owners");
// info owners;
taskWorks = List();
for each  owner in owners
{
if(owner.get("name").containsIgnoreCase("Unassigned"))
{
info "No owner found";
break;
}
else
{
isOwnerPresent = true;
ownerId = owner.get("id");
ownerWorkHours = workhourMapping.get(taskType);
taskWork = Map();
taskWork.put("user_id",ownerId);
taskWork.put("working_hours",ownerWorkHours);
taskWorks.add(taskWork);
break;
}
}
// info taskOwners;
updateTaskParameter = Map();
if(isOwnerPresent)
{
updateTaskParameter.put("owner_work",taskWorks);
updateTaskParameter.put("work_type","work_hours");
updateTaskParameter.put("person_responsible",ownerId);
updateTaskResponse = zoho.projects.update(portalId,projectId,"tasks",taskId,updateTaskParameter,"********");
info updateTaskResponse;
}
}
return "success";


Creating custom functions in Zoho Projects is straightforward and well-documented. Zoho provides a range of built-in functions that you can use as a starting point, and you can also easily define your own functions using Zoho's scripting language, Deluge. Give it a try and see how it can save your time and boost your productivity!

 

Watch this space for more such custom function codes. 


    • Sticky Posts

    • Enhanced Collaboration and Global Web Tabs

      Hello Users, We are rolling out two key enhancements in Zoho Projects that will be part of our November release. Here’s what to expect: 1. Collaboration Section in the Left Navigation Panel What’s new? All communication and interactive tools will be grouped
    • Choosing the Right Automation in Zoho Projects

      In any project, different types of actions are needed at different points. Some projects require control on how tasks move, some require reacting to updates, and some require executing additional actions beyond the task. Automation in Zoho Projects is
    • Introducing Version-3 APIs - Explore New APIs & Enhancements

      New Update - The end of life timeline for V2 APIs has now been extended to 30th June, 2026 Happy to announce the release of Version 3 (V3) APIs with an easy to use interface, new APIs, and more examples to help you understand and access the APIs better.
    • CodeX Scripts for Enforcing Custom Project Logic

      Every organization has a defined way of executing projects. There are clear expectations around how tasks should move, when projects should progress, and which actions require validation. When these rules are consistently followed, projects remain structured
    • Automation Series: Auto-create Dependent Task on Status Change

      In Zoho Projects, you can automatically create and assign a dependent task when a task’s status is updated. This helps teams stay aligned, ensures reviews happen on time, and reduces manual effort. In this post, we’ll walk through an easy setup using
    • Recent Topics

    • Reading emails sent from Zoho

      Hi there, How do I view an email sent from Zoho, for example an email which contains an estimate? I can see there is a tab in the screen for that estimate which is labelled 'Emails' and I can see a summary of the email sent listed there, but I cannot
    • Feature Request: Mass update selected Contacts to Accounts

      I can't believe this isn't an ability already. It's a quick fix that would save hours of manual entry time. This looks like it had been requested 3-4 years ago with no answers from staff! Please add all contact fields into the "mass update" menu. You
    • zoho creator panel add formula

      Hello. I'm using zoho panels which works good for me but i need to add an extra calculation the predefined sum function provided by zoho. not sure if this is possible? The code zoho is generating for the sum is as follows; <text margin='0px' padding='0px'
    • Editing Estimates

      Hi team, How do I delete line items in an estimate when editing it? I can't see any option to do this - no X, no trashcan, no drop down... And how do I revert to the original estimate after cloning? I cloned to see if the option to edit were disabled
    • Support Bots and Automations in External Channels

      Hello Zoho Cliq Team, How are you? We actively use Zoho Cliq for collaboration, including with our external developers. For this purpose, external channels are a key tool since they work seamlessly within the same interface as all of our other channels
    • How To Implement an Auto-Check-out Feature for Attendance?

      If an employee forgets to check out, the system should automatically check out the employee at 6:30 PM
    • Automate the file import step

      Hello everyone, I have a Sales - 'Account' category, and currently import the file to update it as follows: Import Accounts - From File - Update existing Accounts only - select and match the field the CRM. Since we have been using Microsoft 365 SharePoint.
    • Set Default Status of Assembly to "Assembled" When Entered in UI

      I've just discovered the new "confirmed" status of Assemblies within Inventory. While I understand the intent of this (allowing for manufacturing planning and raw material stock allocation), it was initially confusing to me when manually entering some
    • Sender Email Configuration Error.

      Hello Team, Hope you are all doing well. We are in the process of creating the Zoho FSM environment in the UAE. When we try to add the sender email address “techsupportuae@stryker.com”, we receive the error message: “Error occurred while sending mail
    • Share saved filters between others

      Hi, I am in charge to setup all zoho system in our company. I am preparing saved filters for everybody, but the only one can see its me. How can others see it? Thanks
    • Webinar Alert: Learn how to decode your landing page performance with analytics

      Every click, scroll, and drop-off tells a story. Are you listening? Join our Landing Page Analytics webinar to understand how data can reveal what’s working and what’s costing you conversions. In this session, you'll discover The most important metrics
    • Campaign Status Field in CRM

      I'm wanting to create a custom view in CRM that shows all those who have recently hard bounced in past campaigns so we can clean up the database. An old Zoho article said it was possible, but I don't see the option to push campaign status field to CRM,
    • Zoho Forms for Vertical Studio Subscriber Organizations

      We’re excited to introduce the Zoho Forms integration with Vertical Studio. This allows you to capture data using forms and send it directly to your Vertical Studio modules. With this integration, form submissions can be used to create or update records,
    • Zoho Flow not handling Boolean properly

      Hi, I have a checkbox in one system that I'm trying to sync with a checkbox in Zoho CRM. The value from the source system comes in as blank (unticked) or 1 (ticked). I've written the following custom function to convert the output to either boolean false
    • Printing invoice from creator using writer

      Hello. I have created my invoices using Zoho Writer and i'm sending data to them from Zoho Creator by selecting a row in a report and then clicking a button which has workflow connected to it to send the date to the invoice in writer. This is working
    • i want to delete organization or tranfer ownership

      I accidentally created a Zoho organisation and now I cannot accept an invite from another organisation. I am the Super Admin and cannot leave. Please either delete my organisation or transfer ownership so I can leave.
    • Bulk upload images and specifications to products

      Hi, Many users have asked this over the years and I am also asking the same. Is there any way in which we can bulk upload product (variant) images and product specifications. The current way to upload/select image for every variant is too cumbersome.
    • CRM Notes

      Hello, We want to add a Note to the Contact record when a Note is added to a Case or Deal. I wasn't able to do this using a workflow, so I tried using Zoho Flow, but that didn't work either. Does anyone have a suggestion on how we can accomplish thi
    • Zoho FSM API Delete Record

      Hi FSM Team, It would be great if you could delete a record via API. Thank you,
    • Marketing Tip #26: Optimize product images for SEO

      Product images can do more than make your store look good. They can also help customers discover your products through search. Since search engines can’t "see" images, they rely on text signals to understand what an image is about. Two small actions make
    • Allow rejected records (Approval process) to re-enter Blueprints

      Cannot seem to get my head around the key differences between the Blueprints and the Approval Process. For me it seems like different flavours of more or less the same thing - especially now that we have the option of Record Locking. Have a quote to sales
    • Every time an event is updated, all participants receive an update email. How can I deactivate this?

      Every time an event is updated in Zoho CRM (e.g. change description, link to Lead) every participant of this meeting gets an update email. Another customer noticed this problem years ago in the Japanese community: https://help.zoho.com/portal/ja/community/topic/any-time-an-event-is-updated-on-zohocrm-calendar-it-sends-multiple-invites-to-the-participants-how-do-i-stop-that-from-happening
    • Streamlining E-commerce Photography with AI Background Tools

      Hey Zoho Community, I’ve been messing around with ways to make product images less of a headache for fashion brands on Zoho Commerce. You know how boring generic backdrops can get, and how much time traditional photoshoots eat up, right? I tried out this
    • Add @Mention Notifications in Zoho Cliq for Zoho Project Mentions

      Hello Zoho Projects Team, We hope you are doing well. We would like to submit a feature request regarding "Projects Bot" Cliq bot notifications for @mentions inside Zoho Projects comments (Tasks and Issues). Current Behavior: At the moment, when someone
    • WO Completion Status Not Updating Automatically

      Hello Latha, Hope you are doing well. Over the past few days, we have been facing an issue with WO completion. When an AP is marked as complete, the work order status is not automatically updating to “Completed,” and we have to mark it manually. Could
    • Is it possible to create a meeting in Zoho Crm which automatically creates a Google Meet link?

      We are using Google's own "Zoho CRM for Google" integration and also Zoho's "Google Apps Sync" tools, but none of them provide us with the ability to create a meeting in Zoho CRM that then adds a Google Meet link into the meeting. Is this something that
    • Changing naming convention for Estimates

      Hi there, How do I customise the naming of the filenames for estimates when sending them? Currently they are named literally just ES11.PDF or whatever the number of the estimate is. There is no Company name, description of the work, customer name, date
    • Email templates for estimates

      Hi there, When I send an estimate the option to choose a template appears. However it is common to need to make some minor personalizations and modifications to the email before sending ie. adding a second person to the greeting, or adding a small note
    • Customer Message Edit/Delete Function & Backend Visibility Inquiry

      目前客服已发送的对话支持编辑和删除功能,请问在 Zoho 系统后台,是否可以查看客服具体发送了什么内容,以及删除或修改了哪些信息?如果无法查看,这个功能是否可以通过设置关闭客服的编辑和删除权限?如可以,请告知具体设置路径。 Currently, customer service agents are able to edit and delete messages after sending them. In the Zoho system backend, is it possible to view
    • In App Auto Refresh/Update Features

      Hi,    I am trying to use Zoho Creator for Restaurant management. While using the android apps, I reliased the apps would not auto refresh if there is new entries i.e new kitchen order ticket (KOT) from other users.   The apps does received notification but would not auto refresh, users required to refresh the apps manually in order to see the new KOT in the apps.    I am wondering why this features is not implemented? Or is this feature being considered to be implemented in the future? With the
    • Sync Task Status from Zoho Projects to Zoho Desk

      Hi Zoho Desk Team, Hope you’re doing well. We’re actively using the Zoho Desk–Zoho Projects integration, which helps our support and project teams stay aligned. However, we noticed that when we change a task’s status in Zoho Projects, the change is not
    • Lost the ability to sort by ticket owner

      Hi all, in the last week or so, we have lost the ability to sort tickets by Ticket Owner. Unlike the other columns which we can hover over and click on to sort, Ticket Owner is no longer clickable. Is it just us, or are other customers seeing this too?
    • Placeholder doesnt work in email tempalate

      Hi Team,  I have put in the customer happiness rating place holder in my email template but when I pick the template in my ticket and send it to client, the place holder doesnt get generated. What am I missing here? screenshot attached. 
    • Search API filter/sort ignores comment-triggered modifiedTime updates

      Summary When a comment is added to a Call or Account, the parent record's modifiedTime is correctly bumped. This bumped value is visible in: GET /api/v1/calls/{id} ✅ GET /api/v1/calls/search without a filter ✅ — the record's response body shows the new
    • Automation#17: Auto-Create Tasks in Zoho Projects Upon Ticket Creation in Zoho Desk

      Hello Everyone, This edition delivers the solution to automatically create a task in Zoho Projects when a ticket is created in Zoho Desk. Zylker Resorts uses Zoho Desk for bookings and handling guest requests. Zylker resorts outsources cab bookings to
    • Introducing parent-child ticketing in Zoho Desk [Early access]

      Hello Zoho Desk users! We have introduced the parent-child ticketing system to help customer service teams ensure efficient resolution of issues involving multiple, related tickets. You can now combine repetitive and interconnected tickets into parent-child
    • Schedule Timeout 5 minutes vs. stated 15 minutes

      I am running into a function run timeout error after 5 minutes for my schedules. The Functions - Limits documents states it should be 15 minutes: Functions - Limits | Online Help - Zoho CRM. What should it actually be? Due to the 5 minute timeout, I'm
    • Remove Bounced email addresses from CRM after running a campaign

      HI, Is there a simple way to remove bounced leads in the CRM where there email doesn't exist anymore after running a campaign?
    • Building a custom site

      do we have an option in Zoho to build custom sites like adding custom functionalities? want to make a site like jumble puzzle answers for today. Is it doable? Please assist.
    • How to Automate an Unsubscribe based on Scoring

      I automatically assign a negative point score to bounced emails and would like to automate unsubscription of these emails from our Campaigns, without losing the contact data. (Oftentimes the lead is no longer at a business, but I want to keep the business
    • Next Page