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

                                                            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 Q3 saw some new features and
                                                          • 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


                                                                                                    ご検討中の方