Skip to main content
[Command] Set variable
Sophie avatar
Written by Sophie
Updated over 10 months ago

Definition and Usage

The Set variable command is used to assign values to variables that can then be reused throughout your automation workflow. It allows you to initialize a variable and store data like strings, numbers, objects, arrays etc. Common use cases include:

  • Storing locator values like URLs, credentials, server names etc. to be reused instead of repetition

  • Configuring workflow settings like delays, timeouts, retries, batch sizes etc.

  • Reading data from files/databases and storing it in variables for further parsing/manipulation

  • Environment-specific configuration variables for easy switching between production vs staging

  • Reusing fixed values required in multiple places across the automation workflow

  • Branching workflow logic based on conditional checks using variable values

  • Extracting and storing sub-values from larger strings/objects

  • Intermediate computation step values to break complex operations into smaller steps

  • Dynamically generating identifiers, keys for iterations based on business logic

  • Global constant declarations for standard system values

  • Caching extracted data from costly operations to avoid re-computation


Parameter Values

Set parameters

Parameter

Description

Type

Select the variable type

  • String: text and alphanumeric data

  • Number: numeric data

  • Boolean: logical or comparison values

Value

Enter the value of the variable

Name

Save the variable


Error Handling

Parameter

Definition

When error occurs

Select the action to be performed when an error occurs

  • Terminate the project

  • Ignore the error and execute the next command

  • Retry action


Example

The above workflow sets 1 to a number variable named Number.

Did this answer your question?