Power of Automation :: Automate the creation of tasks and link them to the issues.

Power of Automation :: Automate the creation of tasks and link them to the issues.

A custom function is a software code that can be used to automate a process and this allow 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.


Let's take the below User Requirement - 


In the Issues module, when Affected Milestone field is updated, a new task should be created and linked to that issue automatically. Also, the task should be created only if there are no tasks linked with the bug.


The code below will help you to achieve the above requirement. 


Note:: Please refer to this post to access custom function feature within Zoho Projects. 


// TODO: Please create a connection for the Zoho Projects service with the scopes "ZohoProjects.task.ALL, ZohoProjects.Bugs.ALL". Replace 'xxxxxxxxx' with the connection name. Click this link below to learn how to create the connection.

// Link - https://help.zoho.com/portal/en/kb/projects/integration/connections/articles/connections-23-5-2022#How_to_establish_a_Connection



endPoint = "https://projectsapi.zoho.com/restapi/portal/";

endPointV3 = "https://projectsapi.zoho.com/api/v3/portal/";

portalId = "680386201";

connectionName = "connectionprojects";

taskIds = List();

// get associated task

associatedBugResponse = invokeurl

[

url :endPointV3 + portalId + "/projects/" + projectId + "/bugs/" + issueId + "/associated-tasks"

type :GET

connection:connectionName

];

if(associatedBugResponse.get("associated_tasks").size() == 0)

{

// create a task

createTaskParam = Map();

createTaskParam.put("name",taskName);

createTaskParam.put("person_responsible",ownerZPUID);

createTaskResponse = invokeurl

[

url :endPoint + portalId + "/projects/" + projectId + "/tasks/"

type :POST

parameters:createTaskParam

connection:connectionName

];

taskId = createTaskResponse.get("tasks").get(0).get("id_string");

taskIds.add(taskId);

// associate task

associateBugParam = Map();

associateBugParam.put("task_ids",taskIds);

associateBugResponse = invokeurl

[

url :endPointV3 + portalId + "/projects/" + projectId + "/bugs/" + issueId + "/associate-tasks"

type :POST

parameters:associateBugParam

connection:connectionName

];

}


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

    • 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
    • Automate Timesheet Approvals with Multi-level Approval Rules

      Introducing Approval Rules for Timesheets in Zoho Projects. With this automation, teams can manage how timesheets are reviewed and approved by setting up rules with criteria and assigning approvers to handle submissions. Timesheet, when associated to