Pre-General Availability: 2024-09-02

Work with Variables

Create and update variables on the canvas. You can also create variables from within a robot action.

To learn more about variables and other robot resources, see Alternatives to Hard Coding Data.

Create a Variable

A variable holds data temporarily for a robot so that you can use the data somewhere else. You can add a variable on the canvas or from within a robot action.

If you plan to add actions using the recorder, consider creating the variables that you need on the canvas, before you start building the robot. That way, you won't have to pause the recorder to create the variables.
  1. Determine where to start:
    • If you're not actively building a robot, start on the canvas.

      1. In the navigation pane, select Projects.

      2. Select the project name.

      3. In the left toolbar, select Robot Robot.
      4. In the Robots box, select the robot to open.

        The canvas appears.

      5. In the toolbar, select Variables Variables.

        The Variables panel appears.

    • If you need to add a variable while you're in the middle of adding actions to a robot, work within a robot action.

      1. Add an action to a robot.

        See Add an Action to a Robot.

      2. While the panel for the robot action is open, select within any field for which you can provide a value, and select Variables Variables.

        This option is sometimes in the More options More options menu.

        The Variables panel appears.

  2. Select Create Create.

    A new variable is added to the list of variables, and the Variable panel appears.

  3. Fill in the following fields:
    • Name: Enter a name for the variable.

    • Type: Select the type on which to base the variable. If the type that you require doesn't appear, you can create it. See Create a Data Type.

    • Description: Enter a description for the data type.

    • Collection: Select this checkbox if the variable needs to store an array of values. If you leave this checkbox deselected, the variable can store only a single value. For example, if you create a variable to store a value that a robot obtains, and the robot needs to iterate over several records, you must select Collection so that the variable can store a value from each record.

  4. Click OK.
  5. Above the canvas, select Save.

Update a Variable

You can update a variable at any time from the canvas, without having to open an action that uses the variable.

  1. Open the robot whose variable needs to change.
    1. In the navigation pane, select Projects.
    2. Select the project name.
    3. In the left toolbar, select Robot Robot.
    4. In the Robots box, select the robot to open.

      The canvas appears.

  2. On the toolbar, select Variables Variables.

    The Variables panel appears.

  3. Select a variable in the list, and select Edit Edit icon.
  4. Update the fields as necessary, and select OK.
  5. Above the canvas, select Save.