Skip to main content

Update Task

The Update Task is used to update the status of both Wait tasks and Human tasks. The status of a task can be updated in two ways:

  • Using the workflow (execution) ID and the reference name—Update the task status by specifying the workflow (execution) ID and the task's reference name.
  • Using the task execution ID—Update the task status by specifying the task's execution ID.

The Wait task can be updated only if the workflow is in “RUNNING” status, and the invoking user or application should have access to the task being updated.

note

Using the Update Task in scenarios other than its intended use may result in unintended side effects, as it is not designed for such purposes.

Task parameters

Configure these parameters for the Update Task.

ParameterDescriptionRequired/ Optional
inputParameters.taskStatusThe status of the task to be updated. Supported values:
  • FAILED_WITH_TERMINAL_ERROR
  • FAILED
  • COMPLETED
It can be passed as a dynamic variable.
Required.
inputParameters.workflowIdThe execution ID of the workflow containing the task to be updated. It can be passed as a dynamic variable.Required if updating using workflowId and taskRefName.
inputParameters.taskRefNameThe reference name of the task to be updated. It can be passed as a dynamic variable.Required if updating using workflowId and taskRefName.
inputParameters.taskIdThe execution ID of the task to be updated. It can be passed as a dynamic variable.Required if updating using taskId.
inputParameters.taskOutputA key-value map that will be updated as the new task output. Supports string, number, boolean, null, and object/array.Optional.
inputParameters.mergeOutputDetermines whether the output will be merged with the existing task output. The default value is false. Accepted values:
  • true—The output generated by this task (taskOutput) will be combined with the existing task output.
  • false—The output will not be merged.
Optional.

The following are generic configuration parameters that can be applied to the task and are not specific to the Update task.

Schema parameters

You can enforce input/output validation for the task using the following parameters. Refer to Schema Validation for a full guide.

ParameterDescriptionRequired/ Optional
taskDefinition.enforceSchemaWhether to enforce schema validation for task inputs/outputs. Set to true to enable validation.Optional.
taskDefinition.inputSchemaThe name and type of the input schema to be associated with the task.Required if enforceSchema is set to true.
taskDefinition.outputSchemaThe name and type of the output schema to be associated with the task.Required if enforceSchema is set to true.
Other generic parameters

Here are other parameters for configuring the task behavior.

ParameterDescriptionRequired/ Optional
optionalWhether the task is optional.

If set totrue, any task failure is ignored, and the workflow continues with the task status updated to COMPLETED_WITH_ERRORS. However, the task must reach a terminal state. If the task remains incomplete, the workflow waits until it reaches a terminal state before proceeding.
Optional.

Task configuration

This is the task configuration for an Update Task.

{
"name": "update_task",
"taskReferenceName": "update_task_ref",
"inputParameters": {
"taskStatus": "COMPLETED",
"mergeOutput": true,
"workflowId": "${workflow.workflowId}",
"taskRefName": "${workflow.input.taskRefName}",
"taskOutput": {
"key": "value"
}
},
"type": "UPDATE_TASK"
}

Task output

The Update Task will return the following parameters.

ParameterDescription
updatedTaskIdThe task execution ID of the updated task.
taskOutputThe new output of the task, if defined in input parameters.

Adding an Update Task in UI

To add an Update Task:

  1. In your workflow, select the (+) icon and add a Update task.
  2. Select the method required to update the task: using WorkflowId + Task Ref Name or Task ID.
  3. Enter Workflow ID and Task reference name, or Task ID, based on the chosen method.
  4. Select the required Task status.
  5. (Optional) Enable Merge Output if required.
  6. (Optional) Add any Task output parameters.

Adding Update task

Examples

Here are some examples for using the Update Task.

Using Update Task in a workflow

To demonstrate the Update Task, consider the following workflow, which contains a Wait task.

To create a workflow:

  1. Go to Definitions > Workflow, from the left navigation menu on your Conductor cluster.
  2. Select + Define workflow.
  3. In the Code tab, paste the following workflow definition:
{
"name": "WaitTest",
"description": "Test",
"version": 1,
"tasks": [
{
"name": "wait",
"taskReferenceName": "wait_ref",
"inputParameters": {},
"type": "WAIT"
}
],
"schemaVersion": 2
}
  1. Save the workflow.
  2. Select Execute to run the workflow.

This workflow waits indefinitely for an external signal to complete the Wait task.

Workflow in running state

Note the workflow ID and task reference name.

Let’s update the Wait task with the following workflow, which includes an Update Task. Create another workflow using the following definition:

{
"name": "WorkflowToUpdateWaitTask",
"description": "Sample demo workflow",
"version": 1,
"tasks": [
{
"name": "update_task",
"taskReferenceName": "update_task_ref",
"inputParameters": {
"taskStatus": "COMPLETED",
"mergeOutput": false,
"workflowId": "${workflow.input.workflowId}",
"taskRefName": "${workflow.input.taskRef}"
},
"type": "UPDATE_TASK"
}
],
"inputParameters": [
"workflowId",
"taskRef"
],
"schemaVersion": 2
}

Now, run the workflow from the Run tab by entering the input parameters. For example:

Running workflow

Replace the values with those noted from the workflow that contains the Wait task. Select Execute to run the workflow. Once completed, it returns the updated task ID.

Update task output

Finally, verify that the Wait task status is updated successfully in the initial workflow execution.

Completed workflow using update task