For
e.g., a custom function can be used to create a successor task for a parent task. To achieve this, you will
need to create a custom function as given below:
Add the parameters as shown:
Enter the below code in the Deluge editor:
- dependencyType = "FS";
values_map = Map();
values_map.put("name","Task_Name_Here");
values_map.put("description","Sample Deluge Script For Sub task Creation");
createTaskResponse = zoho.projects.create(portalId,projectId,"tasks",values_map);
if(createTaskResponse != null && createTaskResponse.get("tasks") != null)
{
taskInfo = createTaskResponse.get("tasks").get(0);
newTaskId = taskInfo.get("id_string");
dependencyParam = Map();
dependencyParam.put("taskid",newTaskId);
dependencyParam.put("predids",taskId);
dependencyParam.put("projId",projectId);
dependencyParam.put("toupdate","dependencyset");
dependencyParam.put("childprojId",projectId);
dependencyParam.put("dependencytype",dependencyType);
info dependencyParam;
info "------------------";
projectsAPIEndPoint = "https://projectsapi.zoho.com/restapi";
dependency = invokeurl
[
url :projectsAPIEndPoint + "/portal/" + portalId + "/projects/" + projectId + "/taskdependency/"
type :POST
parameters:dependencyParam
connection:"zprojects"
];
info dependency;
info "-------------------------------------";
}
return "success";
Click
Save and Execute to run this custom function. You must now associate this function to a
Workflow rule and save the rule.

When the criteria is met, the Custom Function will be triggered an a successor task will be created.