Automate your tasks workflow using Custom Functions. A custom function is a software code that can be used to automate a process. In Deluge, you can write your own function and call it from one or more Workflow rules. It is similar to Javascript's built-in functions such as DATE, CONCAT, REPLACE, and so on. Custom functions allow you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered.
![](https://img.zohostatic.com/zde/static/images/lights.png)
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.
![](https://help.zoho.com/galleryDocuments/edbsn31cbe10bff197c9e52ed2cf681dfa44fbc1a44d881c6287a5e2091a6bbce642b694ccf0584c3773addb45fde391d02da?inline=true)
When the criteria is met, the Custom Function will be triggered an a successor task will be created.
Feature Availability: Latest Enterprise plan.Benefits:
- Integrate with Zoho Apps or third party apps.
- Automate repetitive task functions.
- Associate with workflow rules to set conditions
Add a Custom Function
- Click
in the top navigation bar.
- Navigate to Marketplace and click Custom Functions under Developer Space.
- Select Tasks from the dropdown box.
- Click Create Custom Function.
- Enter a Function Name and a Description.
- Select a Layout and set the Arguments.
- Type in your code in the Deluge script editor or drag and drop the parameters available in the left panel of the editor and customize them.
- Click Save.
- Click Save and Execute to execute the custom function immediately.
- Enter a task ID or search and fetch the task ID to execute the custom function.
![](https://help.zoho.com/galleryDocuments/edbsn92faf9b329ab4cd94f0e10823e5dddcca77d3c2b39aba2e0bc7be0e853b1e17fdf6b51d0e4f0359792d71513d81fa2f9?inline=true)
If an error occurs while mapping or executing a Custom Function to a Blueprint or Workflow Rule, it can be viewed in the Failure Log. Click and select Failure Log.
Associate a Custom Function to a Workflow Rule
- Click
in the top navigation bar.
- Navigate to Task Automation and click Workflow Rules.
- Select a rule.
- Under Add Actions, click Associate Custom Function.
- You can associate an existing Custom Function or create a new one.
- Click Save Rule.
![](https://help.zoho.com/galleryDocuments/edbsn0d3ff0109c49a92b67f1cdca189cfd3b15b8862d26ee64213bf17231b97c85fe5c1d0ae8aed824ee614494f7ed6ae6e8?inline=true)
Associate a Custom Function to a Blueprint
- Click
in the top navigation bar. - Navigate to Task Automation and click Blueprint.
- Select a Blueprint.
- Under After, click on Custom Function.
- Click Add to associate a custom function or to create a new one.
- Click the Publish button.
![](https://help.zoho.com/galleryDocuments/edbsn9941ecf6a72b6b7acef7f236afdfb0d3caef3e951d52fe4afb4e6e8dc89d9e76dab812ba58c3537e0616a4260e9f493f?inline=true)
- You can add upto 25 custom functions per layout.
- When creating a custom function, a maximum of 25 parameters is allowed.
- The maximum number of custom function failure per day is 20. If a custom function's failure count is reached, it will be disabled automatically, and the user who created the custom function will be notified via email.
- In a portal, a maximum of 5000 custom functions can be executed per day by Workflow Rule/Blueprint.
Gallery Functions
We have a few pre-defined gallery functions that are ready to use.
- Click
in the top navigation bar.
- Navigate to Marketplace and click Custom Functions under Developer Space.
- Select Tasks from the drop-down box.
- Click on the drop-down next to the Create Custom Function button.
- Click Gallery Function.
- Hover over any of the listed functions and click Create.
![](https://help.zoho.com/galleryDocuments/edbsnfba8dd643ad1acdcac30d185f352234cdf1c6fd12e2704694f468b6f1adda0585e00dfa97da371a471b7e63ea27cc069?inline=true)
- Change the description and arguments if needed.
The deluge code is prefilled. The TODO lets users know the edits to the code before it can be executed.
![](https://help.zoho.com/galleryDocuments/edbsn17fc213467209c8d92eb01a1132c4a8dbf1bb882ee3baa112422a8db3b767c10f6100852830ea22d35befb5f4e4e4a15?inline=true)
- Click Save or Save and Execute to run the custom function.
Supported Gallery Functions
- Milestone Autocomplete
- Push Due Date change to Analytics
- Send message in Slack channel
- Send message in Cliq channel
- Update project status
- Change the successor tasks status
- Create successor task
- Create subtask
- Create an issue for the task
- Push status timeline to analytics
Other Actions
Users can edit, delete, clone, or enable REST APIs for a custom function.
- Hover over a custom function and then click
icon.
![](https://help.zoho.com/galleryDocuments/edbsn505f5cfe6af31001c892e520ccdb44a9dac680db965fcfecded84fc353551a310a2906e1581b363cf3b50a1d1ff5ea60?inline=true)
- Select the required option and make the necessary changes.
Edit: Modify the existing custom function
Delete: Deleted the existing custom function
Clone: Create a copy of the custom function
Rest API: Enable the REST API url for the custom function.
![](https://help.zoho.com/galleryDocuments/edbsne8207fa269b277bbfc79a719b120ecd279db577f80c0dba151df8ae3b21a96902100901ae79e8d88b9664a334484c2c1?inline=true)
See Also