Terminate Workflow
The Terminate Workflow task is used to terminate other workflows using their workflow IDs.
Definitions
{
"name": "terminate_workflow_task",
"taskReferenceName": "terminate_workflow_task_ref",
"inputParameters": {
"workflowId": "someWorkflowID", // Single workflow id or an array of workflow ids
"terminationReason": "a termination reason"
},
"type": "TERMINATE_WORKFLOW"
}
Input Parameters
Attribute | Description |
---|---|
workflowId | Provide the workflow IDs of the workflow to be executed. |
terminationReason | Provide the reason for the workflows being terminated. It helps in adding context about why the workflow is terminated. |
Output Parameters
Attribute | Description |
---|---|
terminatedWorkflows | Includes the set of workflow IDs corresponding to the workflows that were terminated. |
Examples
- UI
- JSON Example
- Add task type
Terminate Workflow
. - Add the parameter for workflow IDs to terminate.
{
"name": "terminate-workflows-example",
"taskReferenceName": "terminate-workflows-example-ref-1",
"inputParameters": {
"workflowId": "${workflow.input.workflowIdToTerminate}",
"terminationReason": "This is a test"
},
"type": "TERMINATE_WORKFLOW"
}
Complete Example
Suppose another running workflow is to be terminated; we can create a workflow with the workflow IDs to be terminated.
A sample workflow may look like this:
{
"name": "terminate_workflow",
"description": "Edit or extend this sample workflow. Set the workflow name to get started",
"version": 1,
"tasks": [
{
"name": "terminate_hello_world",
"taskReferenceName": "terminate_hello_world",
"inputParameters": {
"workflowId": "ff2c8cdc-d20e-11ed-b1a7-ce4d7ef052ad"
},
"type": "TERMINATE_WORKFLOW"
}
],
"schemaVersion": 2,
"ownerEmail": "user@orkes.io",
"timeoutPolicy": "ALERT_ONLY"
}
If we run this workflow, the workflow with the mentioned workflowId gets terminated, and we can get the terminatedWorkflowIds from the execution page.
We can copy and paste this ID into the workflow execution URL to view the terminated workflow.
A warning message is displayed indicating that the workflow was terminated.