Skip to main content

Terminate

The Terminate task is a task that can terminate the current workflow with a termination status and reason.

Definitions

    {
"name": "terminate_task",
"taskReferenceName": "terminate_task_ref",
"inputParameters": {
"terminationStatus": "COMPLETED",
"terminationReason": "Task completed successfully.",
"workflowOutput": {
"Some-Key": "Some-Value"
}
},
"type": "TERMINATE"
}
tip

The Terminate task can modify the workflow's output with a given parameter and act as a return statement for conditions where you want to terminate your workflow.

Input Parameters

AttributeDescription
terminationStatusIndicates the termination status. It can take values COMPLETED, FAILED, or TERMINATED.
workflowOutputProvide the expected workflow output.
terminationReasonProvide a reason to give a clear understanding of the termination status.

Output Parameters

AttributeDescription
outputThe content of workflowOutput from the inputParameters. An empty object if workflowOutput is not set.

Examples



  1. Add task type Terminate.
  2. Select the state.
  3. Add the reason.

Adding wait task

Complete Example

Suppose in a workflow; we have to make a decision to ship the courier with the shipping service providers based on input provided while running the workflow. If the input provided while running the workflow does not match with the available shipping providers, then the workflow will fail and return. If the input provided matches, then it goes ahead.
Here is a snippet that shows the default switch case terminating the workflow:

    {
"name": "switch_task",
"taskReferenceName": "switch_task",
"type": "SWITCH",
"defaultCase": [
{
"name": "terminate",
"taskReferenceName": "terminate",
"type": "TERMINATE",
"inputParameters": {
"terminationStatus": "FAILED",
"terminationReason": "Shipping provider not found."
}
}
]
}

Workflow gets created as shown in the diagram.

Terminate Example