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 task can be updated only while it is still in progress. The user or application that starts the workflow containing the Update Task must have Execute permission on the task definition of the task being updated. Otherwise, the task fails.

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 The new output for the task being updated, as a JSON object. Values in the object can be of any type. The output is applied to the updated task and is not returned in the Update Task's output. Optional.
inputParameters.mergeOutput Determines whether taskOutput is merged with the existing output of the task being updated. Must be a boolean. 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 existing task output is replaced with taskOutput. If taskOutput is not set, the task output is cleared.
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 to true, 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.

Examples

Here are some examples for using the Update Task.

Approving an order using Update Task

In this example, an order workflow waits for an approval decision, and a second workflow sends the decision by updating the Wait task's status and output.

Step 1: Create the order workflow

This workflow pauses at a Wait task until it receives a decision, then uses the decision in the next task.

  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": "order_approval",
  "description": "Waits for an approval decision and processes it",
  "version": 1,
  "tasks": [
    {
      "name": "wait_for_approval",
      "taskReferenceName": "wait_for_approval_ref",
      "inputParameters": {},
      "type": "WAIT"
    },
    {
      "name": "process_decision",
      "taskReferenceName": "process_decision_ref",
      "inputParameters": {
        "evaluatorType": "graaljs",
        "approved": "${wait_for_approval_ref.output.approved}",
        "comment": "${wait_for_approval_ref.output.comment}",
        "expression": "(function () { return String($.approved) === 'true' ? 'Order approved: ' + $.comment : 'Order rejected: ' + $.comment; })();"
      },
      "type": "INLINE"
    }
  ],
  "outputParameters": {
    "decision": "${process_decision_ref.output.result}"
  },
  "schemaVersion": 2
}
  1. Save the workflow.
  2. Select Execute to run the workflow.

The workflow stays RUNNING at the Wait task. Copy the workflow execution ID.

Step 2: Create the approval workflow

This workflow uses the Update Task to complete the Wait task and set its output to the approval decision.

Create another workflow using the following definition:

{
  "name": "approve_order",
  "description": "Sends an approval decision to the order workflow",
  "version": 1,
  "tasks": [
    {
      "name": "update_task",
      "taskReferenceName": "update_task_ref",
      "inputParameters": {
        "taskStatus": "COMPLETED",
        "workflowId": "${workflow.input.workflowId}",
        "taskRefName": "wait_for_approval_ref",
        "taskOutput": {
          "approved": "${workflow.input.approved}",
          "comment": "${workflow.input.comment}"
        }
      },
      "type": "UPDATE_TASK"
    }
  ],
  "inputParameters": ["workflowId", "approved", "comment"],
  "schemaVersion": 2
}

Step 3: Run the approval workflow

From the Run tab, run the approve_order workflow with the following input, replacing <WORKFLOW-ID> with the execution ID copied in Step 1:

{
  "workflowId": "<WORKFLOW-ID>",
  "approved": true,
  "comment": "Stock available"
}

The Update Task completes and returns the execution ID of the updated Wait task in updatedTaskId.

Step 4: Verify the result

Open the order_approval execution. The Wait task is COMPLETED with the following output:

{
  "approved": true,
  "comment": "Stock available"
}

The process_decision task uses this output, and the workflow completes with:

{
  "decision": "Order approved: Stock available"
}

To try the rejection path, run order_approval again and send "approved": false with "comment": "Out of stock". The workflow output is then "Order rejected: Out of stock".