Skip to main content

Upgrade Workflow

Upgrade Workflow API upgrades a running workflow to a newer/older version. When the workflow is running, one of the tasks would be currently in the execution state. When this workflow is upgraded using this API, all the tasks in the newer definition before this running task will be marked as skipped.

Input Payload

AttributeDescription
workflowIdThe unique identifier of the workflow to be upgraded.
nameName of the workflow with the latest definition to be upgraded.
versionVersion to which the workflow is to be updated.
taskOutputA map of key and value containing the output of the tasks that will be skipped. Here, the key is the task reference name, and the value is the task output.
workflowInputA map of key and value to be given as the input to the new workflow execution.

API Endpoint

POST /workflow/{workflowId}/upgrade

Client SDK Methods

void upgradeRunningWorkflow(String workflowId, UpgradeWorkflowRequest upgradeWorkflowRequest)

Examples

Sample Workflow

Consider a workflow definition with version 1 as follows:

Upgrade workflow old definition

Now let's run the workflow. Currently simple_task2 is completed, but simple_task4 is in a running state:

Upgrade workflow old instance running

Now, we want to update the workflow to the newer definition with 2 more tasks as follows:

Upgrade workflow new definition

Let's call the upgrade API with the following UpgradeWorkflowRequest:

UpgradeWorkflowRequest upgradeWorkflowRequest = new UpgradeWorkflowRequest();
Map<String, Object> output = Map.of("updatedBy" , "upgrade");
upgradeWorkflowRequest.setTaskOutput(Map.of("simple_task3", output,"simple_task1",output));
upgradeWorkflowRequest.setWorkflowInput(Map.of("name", "orkes"));

upgradeWorkflowRequest.setVersion(2);
upgradeWorkflowRequest.setName(workflowName);

Now, the workflow gets upgraded to the latest version as shown below:

Upgrade workflow new instance running

All the tasks added above the running simple_task4 gets skipped here. The tasks simple_task1 and simple_task3 will have output as per the taskOutput map above. The workflow input will also get changed as per the workflowInput map.