Skip to main content

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

AttributeDescription
workflowIdProvide the workflow IDs of the workflow to be executed.
terminationReasonProvide the reason for the workflows being terminated. It helps in adding context about why the workflow is terminated.

Output Parameters

AttributeDescription
terminatedWorkflowsIncludes the set of workflow IDs corresponding to the workflows that were terminated.

Examples



  1. Add task type Terminate Workflow.
  2. Add the parameter for workflow IDs to terminate.

Adding wait task

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": "a8776d48-7ec9-11ee-8f81-26c6bd51258d"
},
"type": "TERMINATE_WORKFLOW"
}
],
"ownerEmail": "riza.farheen@orkes.io"
}

If we run this workflow, the workflow with the mentioned workflowId gets terminated, and we can get the terminatedWorkflowIds from the execution page.

Terminate Workflow - Successful execution

We can copy and paste this ID into the workflow execution URL to view the terminated workflow.

View of the terminated workflow

A warning message is displayed indicating that the workflow was terminated.