Skip to content

Tasks

User Task

User tasks are used to model tasks that require manual execution. When the process execution reaches a user task, a new task is created in the task list of the user or group assigned to the task.

Configuration Instructions

Due Date

Each task can use a field to mark the due date of the task. The due date is specified using an expression, and the expression return value is Date or String (ISO8601 format). You can use dates entered in previous forms in the process or dates calculated by previous service tasks. If using a time duration, the due date is calculated based on the current time plus the given duration.

User Assignment

User tasks can be directly assigned to users. Only one user can be specified as the assignee of the task. Tasks with an assignee are not visible in other people's task lists, but only in the assignee's personal task list.

Tasks can also be placed in the user's candidate task list. In this case, you need to set "Claim by the following users" or "Claim by the following roles".

Example

Note

  • When both Assignee and Claim by the following users or Claim by the following roles have values, only Assignee is valid.
  • When using Assignee and Claim by the following users, the expression should return an array of user IDs.
  • When using Claim by the following roles, the expression return value should be an array of role identifiers.

Joint Sign and Or Sign

The assignee of a user task can only be one user. In scenarios that require joint sign or or sign, you need to enable the Multi-Instance mode to create a separate user task for each approver.

Refer to the Administrative Assistant Approval node in the Leave Process and the Department Supervisor Interview node in the Onboarding Process.

Task Settings

After a user task is assigned to an Assignee, the user needs to perform a specific action to complete the task after opening the task from the task list. Optional execution actions are Fill in Data Table Form and Execute Automation Task.

When the type is Fill in Data Table Form, the settings are as follows:

Setting ItemDescription
Form IdentifierThe identifier when saving form data to variables
Show Process Info ButtonWhether to show the view process info button on the task page
Store Form Data as Task VariablesAfter enabling, form data will be stored as task variables, and data will be isolated between different task instances
Data Table for Storing FormData table for storing forms
Field SettingsSet the display and edit status of fields in the task form
Form ControlsSet the controls in the task form
Set Form Field Values After CompletionMostly used to change process status and set process variables

Execute Automation After Task Completion

After the task is completed, you can execute an Automation program to complete other work. The automation program here accepts a parameter of type BpmnTaskArgs.

For detailed operations, please refer to Automation Workflow

CC Settings

After task assignment, you can set to send CC reminders to specified users. If specified using an expression, the return value of the expression is an array of user IDs.

Example

js
${Array.of('userID1', 'userID2')} // User ID array
${['userID1', 'userID2']} // User ID array

Expression usage Reference

Service Task

Service tasks are used to execute Automation programs, which accept a parameter of type BpmnTaskArgs. The Automation program can use steps such as Set Workflow Variable and Get Workflow Variable to operate on process variables.

For detailed operations, please refer to Automation Workflow

WARNING

When a service task execution error occurs, the system will roll back the transaction. Turning on the asynchronous execution switch will start a new transaction for execution, which will not affect the original transaction.

Script Task

Script tasks are automatically executed activities. When the process execution reaches a script task, the corresponding script is executed. Script tasks are written in the javascript language.

All process variables can be used in scripts. In this example, the script variable 'inputArray' is actually a process variable (an array of integers).

javascript
// inputArray = [1,2,3,4]
let sum = 0;
for (i in inputArray) {
  sum += i;
}

You can also simply call execution.setVariable("variableName", variableValue) to set process variables in the script.

Example of setting variables in a script:

javascript
var scriptVar = "hello world";
execution.setVariable("myVar", scriptVar);

Note

  • Reserved words cannot be used as variable names, such as: out, out:print, lang:import, context, elcontext.
  • Zhixin-related APIs can also be referenced in script tasks. For information about Zhixin APIs, please refer to the description in the Script chapter.

Receive Task

A receive task is a simple task that waits for a specific message to arrive. Currently, we have only implemented Java semantics for this task. When the process execution reaches the receive task, the process state will be submitted to persistent storage. This means that the process will remain in a waiting state until the engine receives a specific message that triggers the process to continue execution through the receive task.

To make the process instance continue execution from the waiting state of the receive task, you need to call the Trigger Waiting Task to Continue Execution step in the Automation program.

For detailed operations, please refer to Trigger Waiting Task to Continue Execution

Manual Task

A manual task defines a task outside the BPM engine. It is used to model work that the engine does not need to know about and does not need to provide a system or user interface for. For the engine, manual tasks are treated as pass-through activities, and when the process execution reaches a manual task, it automatically continues execution.