Tokens

A token is a bit of text that is automatically replaced with actual values when a bot runs. Tokens allow bots to dynamically work with the content of different elements, even if the content differs from the content that was present when the bot was initially recorded.

Tokens are created when:

Additionally, the Windows Account token is created for you and is replaced by the account name of the Windows user who runs the bot

You can use and edit these tokens in the bot designer as needed.

Example: When recording the Company Name field in a legacy CRM application, the recorder copies the value "Company ABC" and then creates a %(CompanyName) token for that value. Placing the %(CompanyName) token into a field in the new application ensures the bot will populate the field with whatever company name appears in the legacy application and will not just repeat "Company ABC" over and over.

Using Tokens

In the recorder, tokens can be used any place where the token button appears next to a text box. Click the button, and select a token from the list.

In the bot designer, click the <value> link wherever it appears. Then, click the token button Token button. that appears next to the text box, and select a token from the list. Tokens appear as text inside a gray box.

Using the Token Editor

If you only want to use part of the value returned in a single-value token, you can use the Token Editor to apply regular expressions. These expressions can extract just the information you need.

Example: The bot copies data from a file path field (e.g., \My Documents\Sales\Contacts), but when you paste the token into a Folder Name field, you only want the immediate folder returned (e.g., Contacts). You can apply the regular expression: ([^\\]*)$ to the token so that when the bot runs, the folder name, but not the path, is copied to the Folder Name Field.

Tip: If you want to replace token values or append values to multi-value tokens use the Edit Token activity.

To edit tokens in the bot designer

  1. In the bot designer, when writing or pasting a value, click the token button Token button. and select a token.
  2. Click the token to open the Token Editor.
    • Regular expression: Regular expressions are a way of defining patterns in information by using special symbols. These expressions can be used to extract specific information from a token. Under Regular expression, insert the regular expression to edit the token. The regular expression button has common character classes, character escapes, grouping constructs, and more that you can use to a build an expression. Place parentheses around the data you want to use from the token. Learn more about regular expressions.
  3. In the Test value section, enter a sample token value. Click Test to see how the regular expression will be applied to the token.
  4. Click Save.

To edit tokens in the bot recorder

  1. When writing values with the bot recorder, click the token button Token button. to add tokens to your text. This will be a placeholder for information that will be known when the bot runs.

      Example: Insert a token for data you've copied earlier in the recording, input parameters, or the Windows Account running the bot. When the bot runs, those tokens will be replaced with the copied data, parameters, or account name.

  2. Click Show token editor to edit the token.
    • Regular expression: Regular expressions are a way of defining patterns in information by using special symbols. These expressions can be used to extract specific information from a token. Under Regular expression, insert the regular expression to edit the token. The regular expression button has common character classes, character escapes, grouping constructs, and more that you can use to a build an expression. Place parentheses around the data you want to use from the token. Learn more about regular expressions.
  3. When you enter a regular expression, you can see how the expression will be applied in the Result value section.
  4. Click Save.