Power of Automation:: Automatically update the work hours of a task when the status is changed

Power of Automation:: Automatically update the work hours of a task when the status is changed

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. 


Requirement:


User wants the work hours to be updated as zero when the status of the task is changed to ‘On Hold’


We had accomplished this requirement using Custom function at Task level.


Create a connection for Zoho Projects service with the scope “zohoprojects.tasks.ALL” to replace ‘connectionprojects’ with the connection name. Click this link below to learn how to create the connection.


Script to be used:


updateTaskParameter = Map();

ownerIds = "";

isOwnerPresent = false;

taskWorks = List();

taskResponse = zoho.projects.getRecordById(portalId,projectId,"Tasks",taskId,"connectionprojects");

owners = taskResponse.get("tasks").get(0).get("details").get("owners");

for each  owner in owners

{

if(owner.get("name").containsIgnoreCase("Unassigned"))

{

break;

}

else

{

isOwnerPresent = true;

taskWork = Map();

taskWork.put("user_id",owner.get("id"));

taskWork.put("working_hours",0);

taskWorks.add(taskWork);

ownerIds = ownerIds + owner.get("id") + ",";

}

}

taskOwners = ownerIds.removeLastOccurence(",");

if(isOwnerPresent)

{

updateTaskParameter.put("owner_work",taskWorks);

updateTaskParameter.put("work_type","work_hours");

updateTaskParameter.put("person_responsible",taskOwners);

updateTaskResponse = zoho.projects.update(portalId,projectId,"tasks",taskId,updateTaskParameter,"connectionprojects");

} else {

updateTaskParameter.put("work_hours",0);

updateTaskResponse = zoho.projects.update(portalId,projectId,"tasks",taskId,updateTaskParameter,"connectionprojects");

}

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. 


    Access your files securely from anywhere

        All-in-one knowledge management and training platform for your employees and customers.






                              Zoho Developer Community




                                                    • Desk Community Learning Series


                                                    • Digest


                                                    • Functions


                                                    • Meetups


                                                    • Kbase


                                                    • Resources


                                                    • Glossary


                                                    • Desk Marketplace


                                                    • MVP Corner


                                                    • Word of the Day


                                                    • Ask the Experts



                                                              • Sticky Posts

                                                              • 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
                                                              • Introducing the Zoho Projects Learning Space

                                                                Every product has its learning curve, and sometimes having a guided path makes the learning experience smoother. With that goal, we introduce a dedicated learning space for Zoho Projects, a platform where you can explore lessons, learn at your own pace,
                                                              • Update on V2 API End-of-Life Timeline

                                                                Dear Users, Earlier this year, we shared the launch of the V3 APIs and requested users to migrate from the older V2 APIs by December 2025. We have received valuable feedback from our users and partners regarding their migration timelines. We are happy
                                                              • Automation Series: Auto-update Phase Status

                                                                Hello Folks! You can auto-update your phase's status based on status of underlying tasks using custom functions. In this series, we will showcase how to create and run custom functions, using Deluge, with ease. Follow the steps below and automate your


                                                              Manage your brands on social media



                                                                    Zoho TeamInbox 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

                                                                                                Get Started. Write Away!

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

                                                                                                  Zoho CRM コンテンツ




                                                                                                    Nederlandse Hulpbronnen


                                                                                                        ご検討中の方




                                                                                                                • Recent Topics

                                                                                                                • The Social Playbook - February edition: Why moment marketing works (and how brands use it)

                                                                                                                  Imagine the final season of your favorite series is about to drop. Your entire feed is talking about it. Trailers everywhere. Fan theories. Hype at 100%. Now your go-to burger place launches a limited-edition meal box themed around that series—custom
                                                                                                                • PDF Attachment Option for Service Reports

                                                                                                                  Hello Team, I would like to check with you all if there is an option to attach PDF documents to the service reports. When I try to attach a file, the system only allows the following formats: JPEG, JPG, and PNG. Could you please confirm whether PDF attachments
                                                                                                                • Manage Every Customer Conversation from Every Channel inside Zoho SalesIQ

                                                                                                                  Your customers message you from everywhere. But are you really able to track, manage, and follow through on every conversation, without missing anything? With interactions coming in from websites, mobile apps, and messaging platforms like WhatsApp and
                                                                                                                • Approvals in Zoho Creator

                                                                                                                  Hi, This is Surya, in one of  my creator application I have a form called job posting, and I created an approval process for that form. When a user submits that form the record directly adding to that form's report, even it is in the review for approval.
                                                                                                                • Cliq Bots - Post message to a bot using the command line!

                                                                                                                  If you had read our post on how to post a message to a channel in a simple one-line command, then this sure is a piece of cake for you guys! For those of you, who are reading this for the first time, don't worry! Just read on. This post is all about how
                                                                                                                • Depositing funds to account

                                                                                                                  Hello, I have been using Quickbooks for many years but am considering moving to Zoho Books so I am currently running through various workflows and am working on the Invoicing aspect. In QB, the process is to create an invoice, receive payment and then
                                                                                                                • 【Zoho CRM】営業日のロジックに関するアップデート

                                                                                                                  ユーザーの皆さま、こんにちは。コミュニティチームの中野です。 今回は「Zoho CRM アップデート情報」の中から、営業日のロジックに関するアップデートをご紹介します。 本アップデートにより、ワークフローにおける営業日の計算方法が改善されました。 週末などの非営業日にワークフローのトリガーが発生した場合でも、 「+0」「+1」「+2 営業日」といった設定が、意図どおりに正確に動作するようになりました。 営業日に基づくワークフローでは、日付項目を基準に「何営業日後に処理を実行するか」を指定します。
                                                                                                                • Merged cells are unmerging automatically

                                                                                                                  Hello, I have been using Zoho sheets from last 1 year. But from last week facing a issue in merged cells. While editing all merged cells in a sheet became unmerged. I merged it again, but it again unmerged. In my half an hour work I have to do this 3-4
                                                                                                                • Introducing Built-in Telephony in Zoho Recruit

                                                                                                                  We’re excited to introduce Built-in Telephony in Zoho Recruit, designed to make recruiter–candidate communication faster, simpler, and fully traceable. These capabilities help you reduce app switching, handle inbound calls efficiently, and keep every
                                                                                                                • Just want email and office for personal use

                                                                                                                  I am unclear as how to how I would have just a personal email (already do have it and love it) and get to use docs, notebook, workdrive etc. In other words mostly everything I had a google. I find gocs can be free with 5gb and so can mail with 5gb. Are
                                                                                                                • Unable to change the "credentials of login user" option when creating a connection

                                                                                                                  I want to create a new Desk connection where the parameter to use 'credentials of login user' is set to YES. I'm able to create a new connection but am never given the option to change this parameter. Is this a restriction of my user profile, and if so,
                                                                                                                • Show backordered items on packing slip

                                                                                                                  Is it possible to show a column on the Packing Slip that shows number of backordered items when a PO is only partially filled? I would also like to see the Backordered column appear on POs after you receive items if you didn't get ALL of the items or partial amounts of items. And lastly, it would be nice to have the option of turning on the Backordered column for invoices if you only invoice for a partial order. -Tom
                                                                                                                • Zoho Sheet for Desktop

                                                                                                                  Does Zoho plans to develop a Desktop version of Sheet that installs on the computer like was done with Writer?
                                                                                                                • Zoho CRM Community Digest - January 2026 | Part 1

                                                                                                                  The new year is already in motion, and the Zoho CRM Community has been buzzing with steady updates and thoughtful conversations. In this edition, we’ve pulled together the key product enhancements, Kaizen learnings, and helpful discussions from the first
                                                                                                                • Zoho CRM Feature Requests - SMS and Emails to Custom Modules & Time Zone Form Field

                                                                                                                  TLDR: Add Date/Time/Timezone form field, and be able to turn off auto timezone feature. Allow for Zoho Voices CRM SMS Extension to be able to be added to custom modules, and cases. Create a feature that tracks emails by tracking the email chain, rather
                                                                                                                • Introducing Bigin's Add-in for Microsoft Outlook

                                                                                                                  Hello Everyone, Email is an important way to communicate with customers and prospects. If you use Outlook.com for emails and Bigin as your CRM, the Outlook Add-in helps you connect them easily so you can see your Bigin contact details right inside Outlook.com.
                                                                                                                • Ask the Expert – Zoho One Admin Track : une session dédiée aux administrateurs Zoho One

                                                                                                                  Vous administrez Zoho One et vous vous posez des questions sur la configuration, la gestion des utilisateurs, la sécurité ou encore l’optimisation de votre back-office ? Bonne nouvelle : une session Ask the Expert – Zoho One Admin Track arrive bientôt,
                                                                                                                • Zoho Commerce

                                                                                                                  Hi, I have zoho one and use Zoho Books. I am very interested in Zoho Commerce , especially with how all is integrated but have a question. I do not want my store to show prices for customers that are not log in. Is there a way to hide the prices if not
                                                                                                                • Will be possible to create a merge mail template for products?

                                                                                                                  Hi, we would need to create a mail merge template for products (native) module. Will be possibile? or do you have a smart solutions to merge products data with a mail merge? thanks Chris
                                                                                                                • All new Address Field in Zoho CRM: maintain structured and accurate address inputs

                                                                                                                  The address field will be available exclusively for IN DC users. We'll keep you updated on the DC-specific rollout soon. It's currently available for all new sign-ups and for existing Zoho CRM orgs which are in the Professional edition. Latest update
                                                                                                                • How to Associate Zoho Projects in Zoho CRM

                                                                                                                  Hi I need script for associating projects in zoho projects to particular Account in zoho CRM side. It can be done manually but I need the automation for this process. There are no api regarding associating a project in zoho crm account. Need assistance
                                                                                                                • Add Claude in Zoho Cliq

                                                                                                                  Let’s add a real AI assistant powered by Claude to your workspace this week, that your team can chat with, ask questions, and act on conversations to run AI actions on. This guide walks you through exactly how to do it, step by step, with all the code
                                                                                                                • Need to set workflow or journey wait time (time delay) in minutes, not hours

                                                                                                                  Minimum wait time for both Campaigns workflows and Marketing Automation journeys is one hour. I need one or the other to be set to several minutes (fraction of the hour). I tried to solve this by entering a fraction but the wait time data type is an integer
                                                                                                                • Editing Item Group to add Image

                                                                                                                  I did not have the image of the product when the Item Group was created. Now I have the product image, and would like to associate/add to the Item Group. However the Item Group Edit functionality does not show/allow adding/changing image. Please hel
                                                                                                                • Composite Product (kit) - Dynamic Pricing

                                                                                                                  I am setting up Composite Products for item kits that I sell. I also sell the items from the kit individually. Problem is when pricing changes on an individual part, the Composite Product price does not change meaning when the cost of item # 2 in the
                                                                                                                • Urgent: Slow Loading Issue on Zoho Commerce Website

                                                                                                                  Dear Zoho Support Team, I am experiencing slow loading times on my Zoho Commerce website, which is affecting its performance and user experience. The issue persists across different devices and networks. Could you please investigate this matter and provide
                                                                                                                • Zoho Books - France

                                                                                                                  L’équipe de Zoho France reçoit régulièrement des questions sur la conformité de ses applications de finances (Zoho Books/ Zoho Invoice) pour le marché français. Voici quelques points pour clarifier la question : Zoho Books est un logiciel de comptabilité
                                                                                                                • New in Office Integrator: Download documents as password-protected PDFs

                                                                                                                  Hi users, We're excited to introduce password-protected PDF as a download option in Zoho Office Integrator's document editor. This allows you to securely share your confidential information from within your web app. Highlights of the password-protected
                                                                                                                • Sales IQ - Zobot en multilangue

                                                                                                                  Bonjour, J'ai un Zobot installé sur mon site depuis longtemps. J'ai ajouté plusieurs langues, dans la configuration et dans le générateur de bot sans code Pourtant, le Chat continue à s'afficher en Francais. Comment enclencher le multilangue en front
                                                                                                                • 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
                                                                                                                • Is there a way to show contact emails in the Account?

                                                                                                                  I know I can see the emails I have sent and received on a Contact detail view, but I want to be able to see all the emails that have been sent and received between all an Accounts Contacts on the Account Detail view. That way when I see the Account detail
                                                                                                                • Unable to Assign Multiple Categories to a Single Product in Zoho Commerce

                                                                                                                  Hello Zoho Commerce Support Team, I am facing an issue while assigning categories to products in Zoho Commerce. I want to assign multiple categories to a single product, but in the Item edit page, the Category field allows selecting only one category
                                                                                                                • Collapsing and expanding of lists and paragraphs

                                                                                                                  hello Would you ever implement Collapsing and expanding of lists and paragraphs in zoho writer ? Best regards
                                                                                                                • Saving issue

                                                                                                                  First problem I opened a MS word file in writer. after the work is done, it does not save instantly, I waited for like 10min and it still did not save. second problem When I save a file, then file gets saved as another copy. I just did save, not save
                                                                                                                • Notifications Feeds unread count?

                                                                                                                  How do I reset the unread count on feeds notifications?  I've opened every notification in the list.  And the count never goes to zero.
                                                                                                                • Zoho CRM Quotes – Subform and PDF/Writer Limitations

                                                                                                                  Hello, I am encountering the following limitations in Zoho CRM Quotes: Custom product images cannot be uploaded in the subform – the image upload field cannot be added; only the file upload field is available. File upload placeholders cannot be used in
                                                                                                                • Zoho Finance Limitations 2.0 #3: Can't assign a Contact to a Finance Record (estimate, sales order or invoice)

                                                                                                                  If you use a business to business scenario with different contact people within the company you can't assign a finance record (estimate, invoice, etc...) to that person. Why this matters? No way to find out which person placed the order without manual
                                                                                                                • Ranking by group in report

                                                                                                                  Dears, I am new to Zoho Analytics and I would like to ask you guys help to creating a ranking column. Report type: Pivot Matter: I want to create a ranking column on the right of Percentage. This ranking is group by column Type, and ranking by Final Score/Percent.
                                                                                                                • Zoho CRM for Everyone's NextGen UI Gets an Upgrade

                                                                                                                  Hello Everyone We've made improvements to Zoho CRM for Everyone's Nextgen UI. These changes are the result of valuable feedback from you where we’ve focused on improving usability, providing wider screen space, and making navigation smoother so everything
                                                                                                                • Zoho Community Digest — Febrero 2026

                                                                                                                  ¡Hola, comunidad! Un mes más os traemos las novedades más interesantes de Zoho para febrero de 2026, incluyendo actualizaciones de producto publicadas oficialmente, cambios de políticas y noticias del ecosistema. Pero antes de lanzarnos a las actualizaciones,
                                                                                                                • Next Page