docs/devguide/how-tos/Tasks/task-inputs.md
In Conductor, task inputs can be provided in the workflow definition in multiple ways:
"taskInputA": true
"taskInputA": "${workflow.input.someValue}
All dynamic references are formatted as the following expression:
"${type.jsonpath}"
These dynamic references are formatted as dot-notation expressions, taking after JSONPath syntax.
| Component | Description |
|---|---|
${...} | The root notation indicating that the variable will be dynamically replaced at runtime. |
| type | The type of reference. Supported values:<ul><li>workflow—Refers to the current workflow instance.</li> <li>workflow.input—Refers to the workflow’s input parameters.</li> <li>workflow.output—Refers to the workflow’s output parameters.</li> <li>workflow.variables—Refers to the workflow variables set in the workflow using the Set Variable task.</li> <li>taskReferenceName—Refers to a task in the current workflow instance by its reference name. (For example, “http_ref”).</li> <li>taskReferenceName.input—Refers to the task’s input parameters.</li> <li>taskReferenceName.output—Refers to the task’s output parameters.</li></ul> |
| jsonpath | The JSONPath expression in dot-notation. |
Here is a non-exhaustive list of dynamic references you can use:
${<taskReferenceName>.input}
${<taskReferenceName>.output}
${<taskReferenceName>.input.<someKey>}
${<taskReferenceName>.output.<someKey>}
${workflow.input}
${workflow.output}
${workflow.input.<someKey>}
${workflow.output.<someKey>}
${workflow.status}
${workflow.workflowId}
${workflow.parentWorkflowId}
${workflow.parentWorkflowTaskId}
${workflow.workflowType}
${workflow.version}
${workflow.createTime}
${workflow.correlationId}
${workflow.taskToDomain.<domainName>}
${workflow.variables.<someKey>}
Here are some examples for using dynamic references in workflows.
<details> <summary>Referencing workflow inputs</summary>For the given workflow input:
{
"userID": 1,
"userName": "SAMPLE",
"userDetails": {
"country": "nestedValue",
"age": 50
}
}
You can reference these workflow inputs elsewhere using the following expressions:
{
"user": "${workflow.input.userName}",
"userAge": "${workflow.input.userDetails.age}"
}
At runtime, the parameters will be:
{
"user": "SAMPLE",
"userAge": 50
}
If a task <code>previousTaskReference</code> produced the following output:
{
"taxZone": "A",
"productDetails": {
"nestedKey1": "outputValue-1",
"nestedKey2": "outputValue-2"
}
}
You can reference these task outputs elsewhere using the following expressions:
{
"nextTaskInput1": "${previousTaskReference.output.taxZone}",
"nextTaskInput2": "${previousTaskReference.output.productDetails.nestedKey1}"
}
At runtime, the parameters will be:
{
"nextTaskInput1": "A",
"nextTaskInput2": "outputValue-1"
}
If a workflow variable is set using the Set Variable task:
{
"name": "Ipsum"
}
The variable can be referenced in the same workflow using the following expression:
{
"user": "${workflow.variables.name}"
}
<b>Note:</b> Workflow variables cannot be re-referenced across workflows, even between a parent workflow and a sub-workflow.
</details> <details> <summary>Referencing data between parent workflow and sub-workflow</summary>To pass parameters from a parent workflow into its sub-workflow, you must declare them as input parameters for the Sub Workflow task. If needed, these inputs can then be set as workflow variables within the sub-workflow definition itself using a Set Variable task.
// parent workflow definition with task configuration
{
"createTime": 1733980872607,
"updateTime": 0,
"name": "testParent",
"description": "workflow with subworkflow",
"version": 1,
"tasks": [
{
"name": "get_item",
"taskReferenceName": "get_item_ref",
"inputParameters": {
"uri": "https://example.com/api",
"method": "GET",
"accept": "application/json",
"contentType": "application/json",
"encode": true
},
"type": "HTTP",
},
{
"name": "sub_workflow",
"taskReferenceName": "sub_workflow_ref",
"inputParameters": {
"user": "${workflow.variables.name}",
"item": "${previous_task_ref.output.item[0]}"
},
"type": "SUB_WORKFLOW",
"subWorkflowParam": {
"name": "testSub",
"version": 1
}
}
],
"inputParameters": [],
"outputParameters": {}
}
To pass parameters from a sub-workflow back to its parent workflow, you must pass them as the sub-workflow’s output parameters in the sub-workflow definition.
// sub-workflow definition
{
"createTime": 1726651838873,
"updateTime": 1733983507294,
"name": "testSub",
"description": "subworkflow for parent workflow",
"version": 1,
"tasks": [
{
"name": "get-user",
"taskReferenceName": "get-user_ref",
"inputParameters": {
"uri": "https://example.com/api",
"method": "GET",
"accept": "application/json",
"contentType": "application/json",
"encode": true
},
"type": "HTTP",
},
{
"name": "send-notification",
"taskReferenceName": "send-notification_ref",
"inputParameters": {
"uri": "https://example.com/api",
"method": "GET",
"accept": "application/json",
"contentType": "application/json",
"encode": true
},
"type": "HTTP",
}
],
"inputParameters": [],
"outputParameters": {
"location": "${get-user_ref.output.response.body.results[0].location.country}",
"isNotif": "${send-notification_ref.output}"
}
}
In the parent workflow, these sub-workflow outputs can be referenced using the expression format ${<sub_workflow_ref>.output.<someKey>}.
You can verify if the data was passed correctly by checking the input/output values of the task execution in the UI. Common errors: