Read and Review Automation Anywhere Documentation

Automation 360

Close Contents

Contents

Open Contents

Example of passing a value between bots

  • Updated: 8/19/2021
    • Automation 360 v.x
    • Explore
    • RPA Workspace

Example of passing a value between bots

Learn how to pass a value from one TaskBot to another by using a dictionary variable.

To pass values between TaskBots, use any variable type in the child bot and a dictionary variable in the parent bot. This example uses a string called sMySong in the child bot.

Procedure

Build the child bot.

  1. Create a bot:
    1. On the left panel, click Automation.
      A list of available bots and forms is displayed.
    2. Click Create New > Bot.
    3. Provide a name for the bot: FavoriteSongs
    4. Enter the folder location: Bots\TaskBotExample
    5. Click Create and Edit.
  2. Create a variable: sMySong: string type; use as input, use as output.
  3. Use a Prompt > For value action to capture a song name.
    1. Double-click or drag the Prompt > for value action.
    2. In the Prompt window caption field, enter Add a song.
    3. In the Prompt message field, enter Type in a favorite song.
    4. In the Assign the value to a variable field, enter sMySong.
      Note: In the List display mode, your child bot should be one line of code:

      Prompt: For value

  4. Click Save and then click Close.

Build the parent bot.

  1. Create a bot:
    1. From the Control Room interface, select Bots > My bots.
    2. Click Create New > Bot.
    3. Provide a name for the bot: GetFavoriteSongs
    4. Enter the folder location: Bots\TaskBotExample.
    5. Click Create and Edit.
  2. Create the following variables:
    • sMySong: string type
    • sPassedSong: dictionary type/string subtype
  3. Use a Task Bot > Run action to call the child bot:
    1. Double-click or drag the Task Bot > Run action.
    2. In the Task Bot to run field, select Control Room and click Choose.
    3. Click Browse, navigate to Bots\TaskBotExample, and select FavoriteSongs.
    4. In Input values, select Set sMySong.
    5. In Save the outcome to a variable (optional), select Dictionary, and then select sPassedSong.
    6. Click Save.
  4. Use the Dictionary > Get action to accept the value returned from the child bot.
    1. Double-click or drag the Dictionary > Get action.
    2. In the Dictionary Variable field, select sPassedSong.
    3. In the Key field, select sMySong.
    4. In the Assign the output to variable field, select sMySong.
    5. Click Save.
  5. Use a Message box action to report what was returned from the child bot:
    1. Double-click or drag the Message box action.
    2. In the Enter the message box window title field, enter What do you like?.
    3. In the Enter the message to display field, enter You said, $sMySong$.
    4. Click Save.
      Note: In List display mode, your parent bot should look like this:
      Start
      Task Bot: Run and assign output to variable
      Dictionary: Get value of the key "sMySong" from SsPassedSongS
      Message box "You said, $sMySong$"
      End
  6. Run your bot.
    When prompted to Set input variables, click Confirm. Follow the prompts and a message box should return the same value you entered for your song. If no value is returned, ensure you have performed the steps to assign the incoming value to a dictionary key and a variable.
Send Feedback