This operation assigns a task to a user. Use it when a script determines which user should be responsible for the task.
The base request is:
assign(taskId, assignTaskPayload)
Use AssignTaskPayload to specify the user to assign to the task.
The following example assigns a task to a user whose identifier is stored in a process variable:
new RuntimeTaskService()
.assign(
variables.taskId,
{
assignee: variables.assignee,
payloadType: 'AssignTaskPayload'
}
);
Use AssignTaskPayload when a script needs to assign a task to a user.
The following example creates the payload separately:
const assignTaskPayload = {
assignee: variables.assignee
};
new RuntimeTaskService()
.assign(variables.taskId, assignTaskPayload);
In this example:
- assignee: variables.assignee specifies the user to assign to the task.
- assign(variables.taskId, assignTaskPayload) assigns the specified task using the information provided in AssignTaskPayload.