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

      • 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
      • Time Log Reminder

        Tracking the time spent on tasks and issues is one of the most important functions of a timesheet. However, users may forget to update the time logs because they have their own goals to achieve. But, time logs must be updated at regular intervals to keep

        • Recent Topics

        • Introducing SlyteUI : From Idea to a Working Interface in Minutes

          Hello everyone! Are you spending hours building basic UIs? Does even the smallest customization feel like a major task? CRM customization should feel intuitive and straightforward, not time consuming or exhausting. SlyteUI makes this possible by simplifying
        • All new Address Field in Zoho CRM: maintain structured and accurate address inputs

          Availability Update: 29 September 2025: It's currently available for all new sign-ups and for existing Zoho CRM orgs which are in the Professional edition exclusively for IN DC users. 2 March 2026: Available to users in all DCs except US and EU DC. 24
        • Zoho Tables - Form default entry

          How so I set a form field to be populated with an entry from another table? I created a view on my source table limiting the results to just the one thing I want to see. When adding a Client via my Add Client form, I want the Client Type field to already
        • Payment Card or Identity form-fill from Vault?

          Hello! I'm working on replacing Bitwarden with Vault and one issue I've run into is that I can't find any option to fill address and payment forms from Payment Card or Identity info that has been saved in Vault. Is there a way to do this? Is it a planned
        • Please add Deluge code editing for Forms

          Assuming Forms is built on the same codebase as Creator, etc., it would be wonderful to be able to edit form code, cut and paste form elements across different forms, share code with other users, and so on.
        • Introducing Bin Locations In Zoho Inventory

          Hello users, We are excited to let you know that your wait for the Bin Locations feature has now come to an end! Yes, you heard us right! We are here to introduce the much-awaited Bin Locations now in Zoho Inventory. But before we dive into the feature
        • Add Actionable “Smart Commits” for GitHub Integration

          Hi Zoho Projects Team, I am submitting a feature request to introduce Smart Commits support for the GitHub integration in Zoho Projects. The Current Limitation: Currently, Zoho Projects offers a "passive" integration. Including a Task ID in a commit message
        • Item Details Field - New Barcode / Document option?

          Is this a new feature??? its in both books and inventory.
        • Items attribute questions

          Many of my items have attributes, such as size and color. How can I add new fields to the "New Items" screen to capture that in my Purchase Orders, Items, and Sales Order pages? I only see these attribute fields when adding an Item Group. Also, on the
        • SEO recommendation of H1 tag for website tittle

          The exact words are “ It is good practice to place the page title inside the H1tag.” Now I already have one H1 tag on my website but it is not website tittle. In the SEO recommendation that is clear too that I have h1 tag on my page. Now I don’t know
        • Anyone Building AI-Based SEO Dashboards in Zoho Analytics?

          Hey everyone, I’m currently working on an SEO reporting dashboard in Zoho Analytics and looking to enhance it with AI-based insights—especially around AI visibility, keyword trends, and traffic sources. The goal is to track not just traditional metrics
        • Knowledgebase SEO

          We have a custom-domain mapped help center that is not restricted via login. I have some questions: a) will a robots.txt file still allow us to control indexing? b) do we have the ability to edit the sitemap? c) do category URLs get indexed by search
        • Marketing Tip #15: Rank better with keyword-rich URLs for product pages

          Your product page URL is a small detail that can make a surprisingly big difference. Clean, readable URLs help in two ways: They’re easier for customers to trust and remember (no one likes clicking a link that looks messy or random). They help search
        • 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
        • Zia Agents in Zoho CRM: a better way to set up digital employees

          Hello everyone, If you've been using Zia Agents in Zoho CRM, so far using Connections was the only deployment method you're familiar with. You create an agent in Zia Agents (define its objective, write instructions, use tools, add knowledge base) and
        • Cross Module Filtering – Use Fields from Lookup modules in Custom Views criteria and Advanced Filters

          Hello everyone, Zoho CRM now enables you to achieve deeper filtering of records in a module, using fields of a lookup, thereby enhancing your data management experience manifold. This filtering based on lookup module fields is now available in advanced
        • How can we use Loop Structures in Deluge script?

          Hi, I am using GetRecords() function to fetch records from a module in Zoho CRM,  the number of records is 800+, but GetRecords() function returns 200 records at one time,  So, I want to use loops to achieve my task, but it gives me error when i use any loop instead of For each loop. How can I perform my task? Please help Zoho community. Thanks 
        • Stock Count

          The stock count is a nice new feature, but we cannot figure out how to: 1. Use it without assigning to a person, we have a team or one of multiple do stock counts as do most any company. 2. Add any extra fields to what the "counter" sees. The most important
        • SalesIQ Operator Activity Reports in Zoho Analytics

          I'm busy building a dashboard in Zoho Analytics and I want to include SalesIQ stats in the dashboard, but I'm unable to get the statistics mentioned in the attached image. Any idea where I can get the stats for Operator Activity?
        • Multi-Select Field Option Limit Inquiry

          Hello FSM Team, We would like to inquire about the limitation of the Multi-Select field in Zoho FSM. Currently, the system allows a maximum of 10 selectable options, and we encountered the message: “Option count more than allowed count of 10.” Issue:
        • MS Teams integration

          I followed all the steps to configure the bot chanel notifications, for all events. All configuration worked fine, without issues, but I don´t recevie any notification in the Teams chanel. Must I configurate aditional permission set in MS 365 or Zoho
        • Zoho Bookings - Feature Request - Services Which Include A Resource and Consultant

          Hi Bookings Team, My feature request is to have the ability to add Consultants and Resources to Services. Use case: Your business provides first aid training and there are certain equpment you require to provide the half day training. There are only specific
        • Six important date functions every professional should know

          You probably use plenty of formulas already, but there are some that are essential for people in business roles, such as date functions. These tools help with scheduling, predicting, and tracking, and they can be useful whether you're dealing with payrolls,
        • Inactive Items - Make Less Prominent by Default

          Currently, when one marks an Item as "Inactive", it really doesn't do much of anything to hide it or get it out of the way. Search and reporting within Finance should, by default, hide inactive Items from standard reports, searches, etc. If one specifically
        • Why Contracts Should Not Be Downloaded And Sent During Negotiation

          During contract negotiation, it may seem easy to download a document, send it to the counterparty, have the counterparty make changes, and send it back. But this approach creates serious risks around security, version control, and compliance. ISO 27001:2022
        • Add Native “Create GitHub Branch” Action for Tasks and Bugs

          Hi Zoho Projects Team, I would like to submit a feature request to enhance the GitHub integration in Zoho Projects by adding the ability to initiate a GitHub branch directly from a Task or Bug. The Current Limitation: Currently, Zoho Projects lacks a
        • Super Admin Logging in as another User

          How can a Super Admin login as another user. For example, I have a sales rep that is having issues with their Accounts and I want to view their Zoho Account with out having to do a GTM and sharing screens. Moderation Update (8th Aug 2025): We are working
        • Solving the bug in Zoho Writer API for styling

          So... the Zoho Writer APIs for programatically creating a document do not respect a template's style. The result is that any document you generate via API needs to be manually, paragraph by paragraph, reformatted. That bug alone is sufficient to render
        • Is anyone else experiencing downtime on Desk?

          Desk is slow/crashing and not stable the last couple of hours. Is anyone else experiencing the same issues?
        • Push Notification for New Bookings in Zoho Bookings App

          when a someone schedules an appointment through the booking page, is there any option to receive a push notification in the mobile app?
        • Data Import into Zoho Forms

          Hi everyone, I am migrating several Google Forms into Zoho Forms. I can recreate the forms, but I also need to bring over historical response data currently stored in Google Sheets. I want to keep using that data inside Zoho for analysis, reporting, and
        • Add Native GitHub Pull Request Creation & Management from Tasks/Bugs

          Hi Zoho Projects Team, I am submitting a feature request to enhance our development lifecycle by enabling native GitHub Pull Request (PR) creation and management directly within Zoho Projects. The Current Limitation: Currently, the GitHub integration
        • Extend GitHub Commit Integration to Tasks in Zoho Projects

          Hello Zoho Projects Team, We hope you are doing well. We would like to submit a feature request regarding the current GitHub integration in Zoho Projects, specifically the ability to link commit information. Current Limitation: As of now, Zoho Projects
        • Zoho Projects API requests limit question

          Hello, Regarding the API request limit of 100 requests per 2 minutes, I have implemented a control mechanism which, if the limit is reached, will wait the required amount of time before sending new requests. However, this mechanism seems to be failing,
        • What is the esacalation email for Zoho Support/ Zoho One/ Zoho Workplace ?

          Hello, My business has been stalled due to Zoho duplicating workdrive with switching on zoho one trial. There are two workdrives - one with my files mapped to workplace and one empty mapped to zoho one.-- integrationg programs are super consfused and
        • How to show Assemblies AND component items in a report

          Hi Is there any way in Analytics to create a report that shows the Composite Item AND the Component Items with mapped quantity? It seems that the component item is not exposed in any table that I can find. Also, the same question but for Stock on Hand.....this
        • How can I use the API to add a drop-shipping address to a sales order for one-time use?

          I need to be able to add a drop-shipping address for one-time use to a sales order via the API. Adding every such address to the contact (customer), then feeding the shippingaddress_id into the sales order, is not an acceptable approach; we have some
        • Mass Update Option for Changing Work Order Owner

          Hello FSM Team/Mr. Abid, We would like to inquire if there is an option to mass update or bulk change the Owner of Work Orders in Zoho FSM. Current Situation: At the moment, the Owner of a Work Order can only be changed individually, which becomes time-consuming
        • Make and receive calls from Bigin's Android app

          Hello everyone! We're happy to announce that Bigin's Android app (version 2.0.0) now supports built-in telephony, RingCentral, and Zoho Voice, all of which enable users to make and receive calls from the Bigin app. You can only configure the telephony
        • Account Watchlist: Order of accounts in the watchlist

          Is there a way we can sort the order in which accounts are shown in the accounts watchlist in Zoho Books dashboard?
        • Next Page