Skip to main content

Set Variable Task

"type" : "SET_VARIABLE"


Set Variable allows us to set workflow variables by creating or updating them with new values.

Use Cases

Variables can be initialized in the workflow definition as well as during the workflow run. Once a variable is initialized, it can be read or overwritten with a new value by any other task. Variables can be used to manage a state across all your tasks.


Set Variable task is defined directly inside the workflow with the type SET_VARIABLE.


Suppose in a workflow, we have to store a value in a variable and then, later in the workflow, reuse the value stored in the variable just as we do in programming; in such scenarios, the Set Variable task can be used.

Following is the workflow definition with the SET_VARIABLE task.

"name": "Set_Variable_Workflow",
"description": "Set a value to a variable and then reuse it later in the workflow",
"version": 1,
"tasks": [
"name": "Set_Name",
"taskReferenceName": "Set_Name",
"type": "SET_VARIABLE",
"inputParameters": {
"name": "Orkes"
"name": "Read_Name",
"taskReferenceName": "Read_Name",
"inputParameters": {
"var_name" : "${}"
"type": "SIMPLE"
"restartable": true,
"workflowStatusListenerEnabled": true,
"schemaVersion": 2

In the above example, it can be seen that the task Set_Name is a Set Variable Task and the variable name is set to Orkes, and later in the workflow, it is referenced by "${}" in another task.