Skip to content

Define variables

This article explains how to define variables, which you can use to hold and output values in a flow.

This article uses the “Set variable” action.

The action has the following parameters.

Parameter Value
Variable The name of the variable to create
Value The value to store in the variable

action

As a sample, this article uses a flow that defines two variables: a string and a number.

Copy the following code and paste it into the Power Automate Desktop flow designer to add the actions.

SET VarNumber TO 15000
SET VarString TO $'''Hello'''
  1. In “Search actions”, type “Set variable”.

  2. Set the parameters as follows.

    Parameter Value
    Variable %VarString%
    Value Hello
  3. When you run the flow, a variable is defined that you can use to hold and output values in the flow.

Errors can occur when you define the variable if the syntax is wrong, but this action doesn’t throw exceptions while the flow is running.

You don’t need to set up error handling with an “On block error” block.