Skip to 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.

Parameter Description Required/ Optional
inputParameters.taskStatus The 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.workflowId The 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.taskRefName The reference name of the task to be updated. It can be passed as a dynamic variable. Required if updating using workflowId and taskRefName.
inputParameters.taskId The execution ID of the task to be updated. It can be passed as a dynamic variable. Required if updating using taskId.
inputParameters.taskOutput A key-value map that will be updated as the new task output. Supports string, number, boolean, null, and object/array. Optional.
inputParameters.mergeOutput Determines 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.

Other generic parameters

Here are other parameters for configuring the task behavior.

Parameter Description Required/ Optional
optional Whether 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"
}
{
  "name": "update_task",
  "taskReferenceName": "update_task_ref",
  "inputParameters": {
    "taskStatus": "COMPLETED",
    "mergeOutput": false,
    "taskId": "taskID" // hardcoded value or passed as a dynamic input
  },
  "type": "UPDATE_TASK"
}

Task output

The Update Task will return the following parameters.

Parameter Description
updatedTaskId The task execution ID of the updated task.
taskOutput The new output of the task, if defined in input parameters.

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