Using Custom Functions to Solve a Complex Use Case in Zoho Projects

Using Custom Functions to Solve a Complex Use Case in Zoho Projects

Custom functions, also known as user-defined functions or UDFs, allow you to create your own functions in addition to the built-in functions provided within Zoho Projects. One of the key benefits of using custom functions in Zoho is that they allow you to automate complex tasks and calculations.

For example, if you want the status of a parent task to be updated in correspondence with that of its sub-task, this feature lets you write your own code which will perform the desired function. The code below when executed will automatically change the parent task's status to "To be tested" when its sub-task moves to the "To be tested" phase.


// TODO: Please create a connection for the Zoho Projects service with the scopes "ZohoProjects.task.ALL". Replace 'xxxxxxxxx' with the connection name. Click this link below to learn how to create the connection.
taskDetails = zoho.projects.getRecordById(portalId,projectId,"tasks",taskId,"xxxxxxxxx");
info "current task Details : " + taskDetails;
info "-------------------------------------";
parentTaskId = "";
if(taskDetails != null && taskDetails.get("tasks") != null && taskDetails.get("tasks").size() > 0)
{
taskInfo = taskDetails.get("tasks").get(0);
parentTaskId = taskInfo.get("parent_task_id");
}
info "parentTaskId: " + parentTaskId ;
if(parentTaskId != null && parentTaskId != "")
{
parentTaskDetailsOfCurrentTask = zoho.projects.getRecordById(portalId,projectId,"tasks",parentTaskId,"xxxxxxxxx");
if(parentTaskDetailsOfCurrentTask != null && parentTaskDetailsOfCurrentTask.get("tasks") != null && parentTaskDetailsOfCurrentTask.get("tasks").size() > 0)
{
parentTaskInfo = parentTaskDetailsOfCurrentTask.get("tasks").get(0);
parentTaskStatusId = parentTaskInfo.get("status").get("id");
updateTaskParameter = Map();
updateTaskParameter.put("custom_status",parentTaskStatusId);
info updateTaskParameter;
taskDetails = zoho.projects.update(portalId,projectId,"Tasks",parentTaskId,updateTaskParameter,"xxxxxxxxx");
info "updated Task response : "+ taskDetails;
}
}

return "success";


Custom functions also make it easier to collaborate with other team members on your codebase. By encapsulating complex logic in reusable functions, you can create a more modular and flexible codebase especially useful when working on large, complex projects with multiple team members.

 

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. If you're facing a complex use case in Zoho Projects, I highly recommend giving custom functions a try.

 

Watch this space for more such custom function codes.

    Access your files securely from anywhere











                            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

                                                            • Zoho Projects - Q3 Updates | 2025

                                                              Zoho Projects - Q3 Updates | 2025 Hello Users, The final quarter of the year 2025 has begun, and we at Zoho Projects are all set with a plan. New targets to achieve and new milestones to reach, influenced by the lasting imprint of the past quarter. 2025's
                                                            • Introducing Version-3 APIs - Explore New APIs & Enhancements

                                                              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. V3 APIs can be accessed through our new link, where you can explore our complete documentation,
                                                            • Schedule Exports for Regular Project Updates

                                                              Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
                                                            • Set Custom Business Calendars and Holidays for Global Teams

                                                              Managing a project across diverse teams means accounting for more than just tasks and deadlines; it means acknowledging how and when each team actually works. Users might follow different working days or observe region-specific holidays that cannot be
                                                            • Restore Trashed Records Anytime Within 30 Days

                                                              Access the recycle bin from the Data Administration tab under the settings page in Zoho Projects, which gives better control over the trashed data. When records like projects, phases, task lists, tasks, issues, or project templates are trashed, they are


                                                            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 Writer

                                                                                              Get Started. Write Away!

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

                                                                                                Zoho CRM コンテンツ




                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Create static subforms in Zoho CRM: streamline data entry with pre-defined values

                                                                                                              Last modified on (9 July, 2025): This feature was available in early access and is currently being rolled out to customers in phases. Currently available for users in the the AU, CA, and SA DCs. It will be enabled for the remaining DCs in the next couple
                                                                                                            • Global Sets for Multi-Select pick lists

                                                                                                              When is this feature coming to Zoho CRM? It would be very useful now we have got used to having it for the normal pick lists.
                                                                                                            • Introducing Profile Summary: Faster Candidate Insights with Zia

                                                                                                              We’re excited to launch Profile Summary, a powerful new feature in Zoho Recruit that transforms how you review candidate profiles. What used to take minutes of resume scanning can now be assessed in seconds—thanks to Zia. A Quick Example Say you’re hiring
                                                                                                            • Integración Books para cumplir la ley Crea y Crece y Ley Antifraude (VeriFactu)

                                                                                                              Hola: En principio, en julio de 2025, entra en vigor la ley Crea y Crece y Ley Antifraude (VeriFactu). ¿Sabéis si Zoho va a cumplir con la ley para cumplir con la facturación electrónica conectada a Hacienda? Gracias
                                                                                                            • Ask the Experts #1

                                                                                                              Hello everyone! It’s time to transform how you manage projects. Define the processes. Automate the tasks. Streamline the workflows. Let us dive into automation in Zoho Projects — from configuring workflows and custom functions to building triggers, using
                                                                                                            • How to overcome Zoho Deluge's time limit?

                                                                                                              I have built a function according to the following scheme: pages = {1,2,3,4,5,6,7,8,9,10}; for each page in pages { entriesPerPage = zoho.crm.getRecords("Accounts",page,200); for each entry in entriesPerPage { … } } Unfortunately, we have too many entries
                                                                                                            • Checking if Creator has Change History

                                                                                                              Like zForms - whenever an entry was updated there's an option to attached change history to email notif. Trigger -> Successful form submission
                                                                                                            • Unable to create embed code for resource of workdrive using API

                                                                                                              Hello Team, I am trying to create embed code for a resource using workdrive api in powershell, however facing some issues with injecting data in body. Followed Doc: https://workdrive.zoho.com/apidocs/v1/filefoldersharing/shareeveryone Please help, below
                                                                                                            • how to use validation rules in subform

                                                                                                              Is it possible to use validation rules for subforms? I tried the following code: entityMap = crmAPIRequest.toMap().get("record"); sum = 0; direct_billing = entityMap.get("direct_billing_details"); response = Map(); for each i in direct_billing { if(i.get("type")
                                                                                                            • Adding contact role to a specific deal js sdk malfunctioning

                                                                                                              i was trying to add the contact role to a specific deal contact but repeatedly i am getting this error: { "code": "SUCCESS", "details": { "statusMessage": { "code": "INVALID_DATA", "details": { "expected_data_type": "jsonobject" }, "message": "body",
                                                                                                            • Q3 Updates from Bigin!

                                                                                                              Hey Biginners, Hope you’re doing great! As we approach the end of 2025, we truly hope Bigin has been a part of helping you build your dream business this year! We've been busy working behind the scenes to bring you features that make running your business
                                                                                                            • New Series Announcement - Ecommerce Marketing Tips

                                                                                                              Running an online business is more than just having a website. It’s about getting the right customers to discover you, trust you, and keep coming back. To support your growth journey, we’re launching a weekly Marketing Tips series right here on Zoho Commerce
                                                                                                            • Client Script | Update - Introducing Subform Events and Actions

                                                                                                              Are you making the most of your subforms in Zoho CRM? Do you wish you could automate subform interactions and enhance user experience effortlessly? What if you had Client APIs and events specifically designed for subforms? We are thrilled to introduce
                                                                                                            • {"errors":[{"id":"500","title":"Servlet execution threw an exception"}]}

                                                                                                              Here's the call to move a file to trash. The resource_id is accurate and the file is present. header = Map(); header.put("Accept","application/vnd.api+json"); data = Map(); data_param1 = Map(); att_param1 = Map(); att_param1.put("status",51); data_param1.put("attributes",att_param1);
                                                                                                            • Converting Sales Order to Invoice via API; Problem with decimal places tax

                                                                                                              We are having problems converting a Sales Order to an Invoice via API Call. The cause of the issue is, that the Tax value in a Sales Order is sometimes calculated with up to 16 decimal places (e.g. 0.8730000000000001). The max decimal places allowed in
                                                                                                            • Zoho Canvas - Custom templates for related lists

                                                                                                              Hi, I see that the example pages load always one of our related lists in a custom template, but I dont know how to work with that:  1) How can i make my own custom templates for related lists?  2) Where and how can i check out existing custom templates?
                                                                                                            • Kaizen #147 - Frequently Asked Questions on Zoho CRM Widgets

                                                                                                              Heya! It's Kaizen time again, folks! This week, we aim to address common queries about Zoho CRM Widgets through frequently asked questions from our developer forum. Take a quick glance at these FAQs and learn from your peers' inquiries. 1. Where can I
                                                                                                            • open word file in zoho writer desktop version

                                                                                                              "How can I open a Microsoft Word (.doc or .docx) file in Zoho Writer if I only have the file saved on my computer and Zoho Writer doesn't appear as an option when I try 'Open with'? Is there a way to directly open the .doc file in Zoho Writer?"
                                                                                                            • How to invite friends on other social media platforms to one of my group chats in arattai?

                                                                                                              Hello, I have formed chat groups in arattai. I want to invite my friends on other social media platforms like WhatsApp/ FB to one of my groups. Different friends would be invited to different groups. How to share an invite link of one of my groups to
                                                                                                            • Zoho PDF editor has a lot of issues.

                                                                                                              Zoho PDF editor needs a lot of work. It hangs and glitches a lot. Deletes annotations and clearings randomly.
                                                                                                            • stock

                                                                                                              bom/bse : stock details or price =STOCK(C14;"price") not showing issue is #N/A! kindly resolve this problem
                                                                                                            • Zoho sheet desktop version

                                                                                                              Hi Zoho team Where can I access desktop version of zoho sheets? It is important as web version is slow and requires one to be online all the time to do even basic work. If it is available, please guide me to the same.
                                                                                                            • ZOHO SHEETS

                                                                                                              Where can I access desktop version of zoho sheets? It is important to do basic work If it is available, please guide me to the same
                                                                                                            • 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é
                                                                                                            • Using Zoho Flow to create sales orders from won deal in Zoho CRM

                                                                                                              Hi there, We are using Zoho Flow to create sales orders automatically when a deal is won in Zoho CRM. However, the sales order requires "Product Details" to be passed in "jsonobject", and is resulting in this error: Zoho CRM says "Invalid input for invalid
                                                                                                            • Is Zoho Sheet available for Linux ?

                                                                                                              Is Zoho Sheet available for Linux ?
                                                                                                            • Bharat

                                                                                                              a
                                                                                                            • how to disable staff selection Zoho Booking integrated to SalesIQ?

                                                                                                              currently there is only one Consultant in my Zoho Bookings like this I integrate Zoho Bookings into Zoho SalesIQ to create a chatbot. Unfortunately, even though I only have one consultant for a consultation, the user have to pick the consultant. It will
                                                                                                            • Zoho Bookings No Sync with Outlook

                                                                                                              Zoho Bookings appointments are showing on my Outlook Calendar but Outlook events are not showing on Zoho Bookings. How do I fix this?
                                                                                                            • End Date in Zoho Bookings

                                                                                                              When I give my appointments a 30 minutes time I would expect the software not to even show the End Time.  But it actually makes the user pick an End Time.  Did I just miss a setting?  
                                                                                                            • Custom confirmation message

                                                                                                              How can I change the message that users see after they submit the booking form? I have to confirm some details before their appointment is officially "confirmed", so I want to change it where it doesn't say their appointment is "confirmed" but rather
                                                                                                            • Issue showing too many consultations in my workspace link.

                                                                                                              Hi Team, I’ve set up two Workspaces to track meetings from different sources. So far, this has been working well, and the two Workspaces are differentiated without any issues. However, when I navigate to Consultations and share the link to my personal
                                                                                                            • Deluge sendmail in Zoho Desk schedule can't send email from a verified email address

                                                                                                              I am trying to add a scheduled action with ZDesk using a Deluge function that sends a weekly email to specific ticket client contacts I've already verified the email address for use in ZDesk, but sendmail won't allow it in its "from:" clause. I've attached
                                                                                                            • Zoho Learn & Zoho Connect

                                                                                                              Hi, Is there a way to sync the knowledge base we have in Zoho Learn with the manuals section is Zoho Connect? Thanks,
                                                                                                            • Addin Support in Zoho Sheet

                                                                                                              Is there any addin support available in zoho sheet as like google marketplace to enhance productivity by connecting with other apps, providing AI data analysis, streamlining business processes, and more?
                                                                                                            • Changing Corporate Structure - How Best to Adapt Current and Future Zoho Instances

                                                                                                              My current company is Company A LLC with a dba ("doing business as" - essentially an alias) Product Name B. Basically, Company A is the legal entity and Product Name B is what customers see, but it's all one business right now. We currently have a Zoho
                                                                                                            • how to add subform over sigma in the CRM

                                                                                                              my new module don't have any subform available any way to add this from sigma or from the crm
                                                                                                            • How to Install Zoho Workdrive Desktop Sync for Ubuntu?

                                                                                                              Hi. I am newbie to Linux / Ubuntu. I downloaded a tar.gz file from Workdrive for installing the Workdrive Desktop Sync tool. Can someone give me step by step guide on how to install this on Ubuntu? I am using Ubuntu 19.04. Regards Senthil
                                                                                                            • How to upload own video?

                                                                                                              How can you upload your own video on your zoho website? I do not want to use another host, but i want to insert my own files. how can i do this?
                                                                                                            • Support new line in CRM Multiline text field display in Zoho Deluge

                                                                                                              Hi brainstrust, We have a Zoho CRM field which is a Muti Line (Small) field. It has data in it that has a carriage return after each line: When I pull that data in via Deluge, it displays as: I'm hoping a way I can change it from: Freehand : ENABLED Chenille
                                                                                                            • Next Page