Terminate
The Terminate task is used to terminate the current workflow with a specified termination status and reason, and optionally modify the workflow output.
It can act as a return statement when you want to end a workflow without executing subsequent tasks. For example, you can execute certain tasks only when a condition is met and terminate the workflow otherwise.
Task parameters
Configure these parameters for the Terminate task.
| Parameter | Description | Required/ Optional |
|---|---|---|
| inputParameters. terminationStatus | The termination status for the current workflow. Supported values:
| Required. |
| inputParameters. terminationReason | The reason for terminating the current workflow, which will provide the context of the termination. It can be passed as a dynamic variable. | Optional. |
| inputParameters. workflowOutput | A map of the expected workflow output on termination. It can contain a string, number, boolean, null, or object/array. | Optional. |
Task configuration
This is the task configuration for a Terminate task.
{
"name": "terminate",
"taskReferenceName": "terminate_ref",
"inputParameters": {
"terminationStatus": "TERMINATED",
"workflowOutput": {
"someKey": "someValue"
},
"terminationReason": "Terminated due to xxxxxxxx."
},
"type": "TERMINATE"
}
Task output
The Terminate task will return the following parameters.
| Parameter | Description |
|---|---|
| output | A map containing the workflow output defined in inputParameters.workflowOutput. If workflowOutput is not set in the Terminate task definition, the output will be an empty object. |
Adding a Terminate task in UI
To add a Terminate task:
- In your workflow, select the (+) icon and add a Terminate task.
- Select the Termination status.
- Enter the Termination reason.
- (Optional) Add the Workflow output.

Examples
Here are some examples for using the Terminate task.
Terminate a workflow for unsupported input
In this example, a shipping workflow selects a provider based on runtime input. If the input does not match a supported provider, the workflow terminates immediately using a Terminate task and returns an error in the workflow output.
To create a workflow:
- Go to Definitions > Workflow, from the left navigation menu on your Conductor cluster.
- Select + Define workflow.
- In the Code tab, paste the following workflow definition:
{
"name": "shipping-workflow",
"description": "Terminate workflow when shipping provider is unsupported",
"version": 1,
"tasks": [
{
"name": "validate_provider",
"taskReferenceName": "validate_provider_ref",
"inputParameters": {
"shippingProvider": "${workflow.input.shippingProvider}"
},
"type": "SWITCH",
"decisionCases": {
"fedex": [
{
"name": "process_fedex",
"taskReferenceName": "process_fedex_ref",
"inputParameters": {},
"type": "SIMPLE"
}
],
"dhl": [
{
"name": "process_dhl",
"taskReferenceName": "process_dhl_ref",
"inputParameters": {},
"type": "SIMPLE"
}
]
},
"defaultCase": [
{
"name": "terminate_workflow",
"taskReferenceName": "terminate_workflow_ref",
"inputParameters": {
"terminationStatus": "FAILED",
"terminationReason": "Unsupported shipping provider",
"workflowOutput": {
"error": "The specified shipping provider is not supported."
}
},
"type": "TERMINATE"
}
],
"evaluatorType": "value-param",
"expression": "shippingProvider"
}
],
"inputParameters": [
"shippingProvider"
],
"schemaVersion": 2
}
- Select Save > Confirm.
This workflow supports only two shipping providers: fedex and dhl. If any other value is provided at runtime, the Switch task executes the default case and terminates the workflow using the Terminate task.
To run the workflow:
- Go to the Run tab, and enter the Input params. For example:
{
"shippingProvider": "ups"
}
- Select Execute.
This executes the workflow, and because ups is not a supported value, the workflow is terminated using the Terminate task.
