Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

Custom Functions for Tasks

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.

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:
  1. 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.
Feature Availability: Latest Enterprise plan.

Benefits:

  1. Integrate with Zoho Apps or third party apps.
  2. Automate repetitive task functions.
  3. Associate with workflow rules to set conditions

Add a Custom Function

  1. Click  in the top navigation bar.
  2. Navigate to Marketplace and click Custom Functions under Developer Space.
  3. Select Tasks  from the dropdown box.
  4. Click Create Custom Function.
  5. Enter a Function Name and a Description.
  6. Select a Layout and set the Arguments.
  7. 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.
  8. Click Save.
  9. Click Save and Execute to execute the custom function immediately.
  10. Enter a task ID or search and fetch the task ID to execute the custom function.

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

  1. Click   in the top navigation bar.
  2. Navigate to Task Automation and click Workflow Rules.
  3. Select a rule.
  4. Under Add Actions, click Associate Custom Function.
  5. You can associate an existing Custom Function or create a new one.
  6. Click Save Rule.

Associate a Custom Function to a Blueprint

  1. Click   in the top navigation bar.
  2. Navigate to Task Automation and click Blueprint.
  3. Select a Blueprint.
  4. Under After, click on Custom Function.
  5. Click Add to associate a custom function or to create a new one.
  6. Click the Publish button.

  1. You can add upto 25 custom functions per layout.
  2. When creating a custom function, a maximum of 25 parameters is allowed.
  3. 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.
  4. In a portal, a maximum of 5000 custom functions can be executed per day by Workflow Rule/Blueprint.
We have a few pre-defined gallery functions that are ready to use.
  1. Click  in the top navigation bar.
  2. Navigate to Marketplace and click Custom Functions under Developer Space.
  3. Select Tasks  from the drop-down box.
  4. Click on the drop-down next to the Create Custom Function button.
  5. Click Gallery Function.
  6. Hover over any of the listed functions and click Create.

  7. 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.

  8. Click Save or Save and Execute to run the custom function.
  1. Milestone Autocomplete
  2. Push Due Date change to Analytics
  3. Send message in Slack channel
  4. Send message in Cliq channel
  5. Update project status
  6. Change the successor tasks status
  7. Create successor task
  8. Create subtask
  9. Create an issue for the task
  10. Push status timeline to analytics

Other Actions

Users can edit, delete, clone, or enable REST APIs for a custom function.
  1. Hover over a custom function and then click icon.

  2. 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.



See Also




Helpful?12
Updated: 5 months ago
Share :
1 comment

When I do this. I get the subtask added as 6 successive actions and a 6 part tree builds under the main task. It's looping for some reason and I can't figure out why. It adds a subtask, and then a subtask to that subtask, and then a subtask to that.... .etc  It does that 6 times.

I have deleted everything and started over, with the same results.