This operation completes a task. Use it when script logic can complete a task and, optionally, provide variables as part of the task completion.
The base request is:
completeTask(taskId, completeTaskPayload)
Use CompleteTaskPayload to provide variables when completing the task.
The following example completes a task with outcome and comment variables:
const completeTaskPayload = {
variables: {
outcome: 'approved',
comment: variables.comment
}
};
variables.task =
new RuntimeTaskService()
.completeTask(
variables.taskId,
completeTaskPayload
);
In this example:
- outcome: 'approved' provides the outcome value when the task is completed.
- comment: variables.comment provides the value stored in the comment process variable.
- completeTask(...) completes the specified task using the information provided in CompleteTaskPayload and assigns the result to the task process variable.