Get action in Dictionary

Use the Get action in the Dictionary package to verify if a key exists in a dictionary variable and return the corresponding value.

Settings

  • Select the dictionary variable from the drop-down list.
  • Enter the key name.
  • Select a dictionary variable or create one to hold the output.

Example of using Get Dictionary action in an automation

This example shows you how to create a bot that retrieves a dictionary value from a dictionary variable.
  1. Create a bot.
    1. On the left panel, click Automation.

      A list of available bots and forms is displayed.

    2. Click Create a bot.
    3. Enter the bot name: Dictionay_Get.
    4. Click Create and Edit.
  2. Create the user-defined variables using the Create variable (+) icon at the top of the Variables menu.
    1. Create a variable of Dictionary type: AppraisalData_FY23
    2. Enter the following key-pair values in the AppraisalData_FY23:
      Key Value
      Name Bob, John, Sarah
      Age 52, 26, 42
      Job title Sr. Developer, Technical Writer, HR
      Email ID bob.jones@abc.com, john@abc.com, sarah@abc.com
      Phone number 752000000, 753000000, 754000000
      CTC $160,000, $110,000, $100,000
      Bonus component Sr. Developer: 15%, Technical Writer: 15%, HR: 15%
      Employment type Sr. Developer: Permanent, Technical Writer: Contractor, HR: Permanent
  3. Double click or drag the Get action to retrieve a dictionary value.
    1. Select AppraisalData_FY23 dictionary variable from the drop-down list.
    2. Enter CTC in the Key field.
    3. To store the output, select SampleString from the Assign the output to variable field.
  4. To print the value of the dictionary variable, double-click or drag the Message box action. Select SampleString from the Enter the message to display field.
  5. Click Save and then Run.

    The output is displayed as:

    Value retrieved from a dictionary variable