Get Variable

The Get variable building block retrieves the value of a variable and makes it available to other building blocks. Variables can be scoped so they are available only within the same case run, across all cases in a schedule run, or permanently for as long as the project exists.

A variable must be defined using Set Variable before you use Get variable. If the variable does not exist, the block throws an error and the Default value is used instead (for example: Variable 'NameOnGetVariable' does not exist, default value ...).

See the Use Numbers and Variables lesson for examples on how to use variables.

Fully expanded, the Get Variable block shows the following properties:

image-20260202-101650.png

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 Get variable onto the canvas.

  2. Specify Variable name, choose Scope, and optionally set Default value. Then connect Result value to the next block that needs the variable value.

  3. Run the flow when it’s ready.

Building block parameters

Parameters
  • Block header: Shows the current title of the block. You can rename it by double-clicking the header text and typing a new title. This block has no green input or output connectors in the header because it is not explicitly executed. Instead, it retrieves a value and delivers it to other blocks.

  • Variable name: The name of the variable to retrieve. Variable names are case-sensitive.

  • Result value: Outputs the retrieved variable value so it can be passed to other building blocks.

  • Scope: Defines where the block looks for the variable.

    • Only this case: The variable exists only during the execution of the current case run. This is the default and usually the most appropriate choice.

    • Schedule: The variable exists across all cases in the same schedule run.

    • Permanent: The variable persists across runs and remains available day after day for as long as the project exists.
      Variables with different scopes are unique, so a variable named “test” in Permanent scope is not the same as a variable named “test” in Only this case scope.

  • Default value: A fallback value to use if the variable cannot be found in the selected scope.
    Note: If you leave Default value empty and the variable does not exist, the block uses an empty string ('') as the default, which means downstream blocks (for example, Log message) may receive and display a blank value.

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.