Environment variables

Environment variables are variables present in all scripts that store data about the current working environment, including information about the runtime and the script. These data are often called properties or metadata.

By default, all scripts have environment variables. They are read-only variables, which means that you can only read their data during runtime to create logical flows that depend on environment metadata or log the data by using the Log Message (logMessage) command.

Environment variables types

Environment variables have variable types and are organized as follows:



  • rpa:errorLineNumber
    The line number where the error occurred.

  • rpa:lineNumber
    The line number of the current command.

  • rpa:scriptVersion
    The version of the current script.

Note: The version is only returned when the script is running in a production environment. It does not return its value when running in debug mode.


  • rpa:errorMessage
    Specific message about the error that occurred.

  • rpa:errorSubName
    The name of the subroutine where the error occurred.

  • rpa:parentSubName
    The name of the subroutine that calls the current subroutine.

  • rpa:subName
    The name of the current subroutine.

  • Added in 21.0.5: rpa:runtimeEnvironment
    The runtime environment the script is running in. If the script is running on IBM RPA Studio, it returns Development. If it is running on Bot Runtime, it returns Production.

  • Added in 21.0.5: rpa:scriptName
    The name of the current script. If you are using or running the script on IBM RPA Studio, it returns the .WAL file name. If you are running the script on Bot Runtime, it returns the script's name as published.

Time Span

  • rpa:redTime
    The maximum time a schedule of the script can run before it is canceled.


  • Added in 21.0.5: scriptMetadata
    The script's metadata. Returns a summary of data such as Labels, Routines, RuleSets Assets, Variables.

Environment variable properties

As normal variables, environment variables also have properties, an rpa:error environment variable can have properties like Message and StackTrace, and these properties can have properties like Lenght and Count. If you are not familiar with variable properties, check the Using variable properties tutorial.

Environment variables in IBM RPA Studio

The Variables pane displays all the variables of your script including the environment variables, to visualize them click the Toggle environment variable visibility button. You can also view them when selecting variables in any command by clicking the Toggle environment variable visibility or using the CTRL + E shortcut.

The following image highlights the Toggle environment variable visibility button.

Toggle environment variables button