Skip to main content

Task Inputs

Task inputs can be provided in multiple ways. This is configured in the workflow definition when a task is participating in the workflow.

Inputs referred from Workflow inputs

When we start a workflow, we can provide inputs to the workflow in a json format. For example:

{
"worfklowInputNumberExample": 1,
"worfklowInputTextExample": "SAMPLE",
"worfklowInputJsonExample": {
"nestedKey": "nestedValue"
}
}

These values can be referred to as inputs into your task using the following expression:

{
"taskInput1Key": "${workflow.input.worfklowInputNumberExample}",
"taskInput2Key": "${workflow.input.worfklowInputJsonExample.nestedKey}"
}

In this example, the tasks will receive the following inputs after they are evaluated:

{
"taskInput1Key": 1,
"taskInput2Key": "nestedValue"
}

Inputs referred from other Task outputs

Similar to how we can refer to workflow inputs, we can also refer to an output field generated by a task executed before.

Let's assume a task with the task reference name previousTaskReference executed and produced the following output:

{
"taskOutputKey1": "outputValue",
"taskOutputKey2": {
"nestedKey1": "outputValue-1"
}
}

We can refer to these as the new task's input by using the following expression:

{
"taskInput1Key": "${previousTaskReference.output.taskOutputKey1}",
"taskInput2Key": "${previousTaskReference.output.taskOutputKey2.nestedKey1}"
}

The expression format is based on Json Path and you can construct complex input params based on the syntax.

Hard-Coded inputs​

Task inputs can also be hard-coded in the workflow definitions. This is useful when you have a re-usable task with configurable options that can be applied in different workflow contexts.

{
"taskInput1": "OPTION_A",
"taskInput2": 100
}