Set Variable | Leapwork Docs

The Set variable block is used to assign a value to a variable. Variables can be scoped so they are only available during a single case run, across all cases in the same schedule run, or permanently for as long as the project exists.

Fully expanded, the Set variable block shows the following properties:

Note: The screenshot on this page uses the Elegance Design, introduced in 2025.3. If you are using an earlier version, your layout may look different.

Quick-start

  1. Drag Set variable onto the canvas.
  2. Enter a Variable name and Value (both required), and optionally adjust the Scope and add Text fields for dynamic content.
  3. Run the flow when it’s ready.

For a minimal setup, provide a name and value, keep the default scope, and place the block where you want the variable to be updated.

Building block parameters

Parameters

Variables with the same name but different scopes are treated as distinct. For example, a variable named test with Permanent scope is not the same as a variable named test with Only this case/flow scope.

Resources

Topic Description
Flows FAQ Common questions about creating, running, and managing flows in Leapwork.
Flows Troubleshooting Guidelines and solutions for identifying and fixing issues that occur when building or running flows in Leapwork.