Set Workflow Variables

Updated 2 months ago by Archana Singh

You can set variables in the Workflow Variables section of your Workflow, and use them in the Workflow step commands and settings. For information on variables and expressions, see Variables and Expressions in Harness and Passing Variables into Workflows and Pipelines from Triggers.

In this topic:

Before You Begin

Step: Add Workflow Variables

To use Workflow variables, do the following:

  1. In a Workflow, click the pencil icon next to Workflow Variables. The Workflow Variables dialog appears.

Workflow Variables have the following settings.



Variable Name

Enter a name for the variable. When the variable is referenced elsewhere in you Harness application, the variable name is used.


Select Text.

Allowed Values

Enter a comma-separated list of values that users can select. The list will appear as a drop-down menu when the Workflow is deployed.

Default Value

Enter a value for the variable. A value is not mandatory.


Select this option to enforce that a value for the variable is provided before the Workflow is executed.


Select this option if the value of the variable specified here must not be changed.


Provide a description of the variable that lets others know its purpose and requirements.

  1. In a Workflow step, use your variable by typing a dollar sign ($) and the first letter of your variable. The syntax for variable names is ${}.

Harness will load matching variable names.

For example, if you created a variable named Url, the variable name is ${workflow.variables.Url}.

When you deploy the Workflow, by itself or as part of a Pipeline, the variables are displayed in the Workflow execution step.

If the variables require values, you will enter the values when you add the Workflow to a Pipeline in the Stage settings or in the New Deployment setting when you deploy the Workflow individually.


Workflow variable expressions in Services — You can use Workflow variable expressions in a Harness Service, but Harness does not autocomplete Workflow variables in a Service like it does in a Workflow. You will need to manually enter the Workflow variable expression in the Service: ${}.

Next Steps

How did we do?