Read and Review Automation Anywhere Documentation

Automation 360

Close Contents

Contents

Open Contents

Example of passing a value between bots including full video

  • Updated: 2022/07/07
    • Automation 360 v.x
    • Build
    • Enterprise

Example of passing a value between bots including full video

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

Note: Please follow the steps in this task and view the corresponding video. Please offer feedback on your experience of the video content, video placement within the topic, and to what degree video content enhances your understanding of the described task. While text is virtually identical in both topics of this study, we ask that you judge contributing elements to the ease of use and satisfaction of the contrasting video content for these two topics.

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 variable called sMySong in the child bot.

Tip: Access video demonstration through the following link. The right side panel of the video player offers navigation to each corresponding step performed in this example.

Procedure

Create the child bot that will capture the song name.

Relevant video timestamps:

  • Build the Child Bot
  • Create the variable 'smysong'
  • Use the prompt 'for value'
  • Click save and then click close

  1. Build the child bot with the following steps:
    1. On the left panel, click Automation.
      A list of available bots and forms is displayed.
    2. Click Create New > Bot.
    3. Enter the name for the bot as FavoriteSongs
    4. Enter the folder location as Bots\TaskBotExample.
    5. Click Create and Edit.
  2. Create the variable: sMySong and select both check-boxes: use as input and use as output for this variable.
  3. Use the Prompt > For value action to capture a song name.
    1. Find the action Prompt > for value and double-click or drag the action into your flow.
    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.

Create the parent bot that will call data from the child bot.

Relevant video timestamps:

  • Build the Parent Bot
  • Create the folowing two variables
  • Use the task bot run action

  1. Build the parent bot with the following steps:
    1. From the Control Room interface, select Bots > My bots.
    2. Click Create New > Bot.
    3. Enter the name for the bot as GetFavoriteSongs.
    4. Enter the folder location as Bots\TaskBotExample.
    5. Click Create and Edit.
  2. Create the following two variables:
    1. sMySong: select string as the subtype
    2. sPassedSong: select dictionary as the type and string as the subtype
  3. Use the Task Bot > Run action to call the child bot:
    1. Find the action Task Bot > Run and double-click or drag the action into your flow.
    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 the section Input values, select Set sMySong.
    5. In the Save the outcome to a variable (option), select Dictionary, and then select sPassedSong.
    6. Click Save.

Configure the parent bot to get the value from the variable and prompt the user.

Relevant video timestamps:

  • Use the action dictionary
  • Use a message box action
  • Click run to deploy your bot

  1. Use the action Dictionary > Get to accept the value returned from the child bot.
    1. Find the action Dictionary > Get and double-click or drag the action into your flow.
    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.
  2. Use a Message box action to report what was returned from the child bot:
    1. Find the action Message box and double-click or drag the action into your flow.
    2. In the field Enter the message box window title, 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
  3. Click Run to deploy 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