This operation saves task data without completing the task. Use it when a script needs to save task variables as draft data while keeping the task open.
The base request is:
saveTask(taskId, saveTaskPayload)
Use SaveTaskPayload to specify the task variables to save.
The following example saves a draft comment:
new RuntimeTaskService()
.saveTask(
variables.taskId,
{
variables: {
draftComment: variables.comment
}
}
);
Use SaveTaskPayload when a script needs to save task variables without completing the task.
The following example saves multiple task variables:
const saveTaskPayload = {
variables: {
draftComment: variables.comment,
savedByScript: true
}
};
new RuntimeTaskService()
.saveTask(
variables.taskId,
saveTaskPayload
);
In this example:
- draftComment: variables.comment saves the value stored in variables.comment.
- savedByScript: true saves a Boolean value indicating that the data was saved by the script.
- saveTask(...) saves the variables provided in SaveTaskPayload without completing the task.