Workflow Output Binding
When a workflow is triggered in "wait" mode, its output is available as {{ workflowOutput.* }} tokens in the actions that run after completion — enabling results-driven navigation and variable updates.
When Workflow Output Is Available
Workflow output tokens are only available in the onSuccess and onError handlers of a trigger-workflow action where waitForCompletion: true:
// trigger-workflow with wait — output available in onSuccess
{
"type": "trigger-workflow",
"processId": "calculate-credit-score",
"waitForCompletion": true, // ← required for output access
"input": {
"customerId": "{{ route.id }}"
},
"onSuccess": {
"type": "chain",
"actions": [
// workflowOutput.* tokens available here
{
"type": "set-variable",
"variable": "creditScore",
"value": "{{ workflowOutput.score }}"
},
{
"type": "set-variable",
"variable": "creditGrade",
"value": "{{ workflowOutput.grade }}"
},
{
"type": "navigate",
"target": "/customers/{{ route.id }}/credit-result"
}
]
}
}
Workflow Output Structure
The workflowOutput object contains all key-value pairs emitted by the workflow's terminal node output. The specific fields depend on the Flow Studio process definition:
// Example: calculate-credit-score workflow terminal output
{
"score": 742,
"grade": "A",
"approved": true,
"maxCreditLimit": 15000,
"recommendations": ["Consider premium tier", "Auto-approve up to $5000"]
}
// In App Studio onSuccess:
{{ workflowOutput.score }} → 742
{{ workflowOutput.grade }} → "A"
{{ workflowOutput.approved }} → true
{{ workflowOutput.maxCreditLimit }} → 15000
Displaying Results via Variables
The pattern for displaying workflow results in the UI is: trigger workflow → capture output in variables → display variables in widgets:
// Step 1: Trigger workflow, capture output to variables
onSuccess.actions:
- set-variable: creditScore = {{ workflowOutput.score }}
- set-variable: creditGrade = {{ workflowOutput.grade }}
// Step 2: Text widget bound to variables
{
"content": "Credit Score: **{{ variables.creditScore }}** (Grade {{ variables.creditGrade }})"
}
When waitForCompletion: true, the app waits synchronously for the workflow to finish before executing onSuccess. For long-running processes, this blocks the user — show a loading indicator by setting an isLoading variable to true before triggering, and false after. Use fire-and-forget for processes expected to take more than a few seconds.