Add a Scope

A Scope lets you logically group interactions and automation actions, and also define exceptions using a fault handler.

You can manage a group of actions and fault handlers with a Scope to configure local exception handling for a robot agent. The Scope logic can be nested at any level and can be added to other container actions or flow controls such as Frame, foreach, and switch.

Use Case

You want to open an application from a browser, enter search text, click Search and wait for the search results to be displayed. You have added an Alert action if there is an unexpected browser pop-up dialog box before the search text is entered.

However, if the browser pop-up dialog box does not display, then the robot agent will not be able to proceed and execute the further steps.


Scope action use case

You can handle this error scenario by adding a Scope.

Add a Scope

Note:

You must use the low-code capabilities to add this logic to a robot. Keep reading for step-by-step instructions.
  1. Open the robot for editing.
  2. Add the logic to the robot.
    1. On the canvas, point to an action, and click +.

      A menu of available actions appears.

    2. Select the Flow control tab.

      The Flow control tab is selected

    3. In the list, select Scope.

      A Scope action appears on the canvas.

  3. Name the Scope action.
    1. In the panel, enter a Name and Description for the action.
    2. Select OK.
  4. Add one or more actions to the Scope.
    1. Point to the Scope, and select the > button to expand it.

      The Scope expands, and a plus sign appears in it.

    2. Define actions or logic that the robot takes if there is an exception. Add a message alert if the robot agent comes across an unexpected browser pop-up dialog box.Add an action to Scope
  5. In scenarios where the unexpected browser pop-up dialog box is not displayed, the robot agent will fail and not be able to proceed further. To avoid this, add a fault handler to handle the exception and continue executing the next steps.
    1. Within the Scope box on the canvas, point to Actions icon, select Fault handlers.
    2. Select the exception value from the list. This list of exceptions is dynamically generated at runtime based on the actions included in the Scope.Add a fault handler to Scope
    3. You can also select + Define fault handler and create a new fault handler or create a default fault handler to handle exceptions.Define a fault handler
  6. Click OK.
  7. Above the canvas, select Save.

See the following examples to understand how the robot agent with scope can handle exceptions.

Example: Robot agent with Scope for handling exceptions

When you run the robot agent, it will handle the exception locally and continue with the next steps.Robot agent with Scope for handling exceptions

Example: Robot agent without Scope

If you have configured the robot agent without a Scope, it will stop when it encounters an error and not execute the next steps.Robot agent without Scope