Contact Us 1-800-596-4880

Managed

The Managed block allows you to handle errors within your Workflow as they happen. It also can be used to make sure that certain Action Steps or Transactions are executed, even if an error occurred.

Properties

  • OnError section behavior If an error happens within the OnError section, it can either be handled like any other error (Normal error handling) or the Workflow can be immediately aborted (Abort script on error).

  • In the first case the DoAlways part will be executed before program termination, in the latter case not.

DoAction

This is the default path of the Managed Block. The RPA Bot will first try to execute all Action Steps within the DoAction section. If an error occurs (e.g. an Image search fails), the execution of the DoAction section will be aborted and the OnError section will be executed. If the OnError section is empty, an error within the DoAction section will cause the Managed Block to enter an error state.

OnError

This section will be executed if an Action Step within the DoAction section has failed. You can try to handle the error here and restore a state in which the rest of the Workflow can still be executed normally, even though the DoAction section failed. If all items within the OnError section are executed successfully, the Managed Block is considered successful ($run = 1). Note that an empty OnError section will not change the run state. Use Force OK State (see Section 3.8.4) for that.

However, if an error occurs within the OnError section, its execution will be aborted and the Managed Block will remain in the error state ($run = -1). What happens next depends on the setting for behavior of the OnError section. If it is set to Normal error handling, the Workflow will handle an error in the OnError section like all other steps, meaning the error can be handled by an enclosing Managed Block. If it is set to Abort script on error the Workflow will be instantly aborted if any further error happens within the OnError section.

DoAlways

The DoAlways section will be executed at the end of the Managed Block, regardless of whether an error has occurred within the Managed Block or not. The only exception is when the OnError section behavior is set to Abort script on error and error occurred within the OnError section. If an error occurs within the DoAlways section, its execution will be aborted but the error state of the Managed Block will remain unchanged. Execution of the DoAlways section has no influence on the error state, which will always be the same as at the time the section was entered.

Example

The following example will show you how to react to common problems directly in your Workflow using the Managed Block.

Imagine you want to open up an Internet Explorer window and enter a web address. First you start Internet Explorer using run program, search for the address bar to verify that Internet Explorer is loaded, and then enter the web address.

Usually, when Internet Explorer starts, the focus will be on the address bar.

This is what we are searching for with the Image search. When we find it, we simply enter the web address and are done.

However, it is a common problem that sometimes Internet Explorer loses the focus immediately. This means that the address bar text will not be highlighted and have the focus.

The Image search will not find this. Plus, the address bar does not have focus, so you cannot simply start typing with the keystroke item. The desired website will not be opened.

The Managed Block gives you the perfect solution for this problem.

You put Run Program and Image search within the DoAction section and Keystrokes containing the web address in the DoAlways section.
If you do not find the Pattern image, the Managed Block will execute the OnError section. There, you simply put another keystroke to press F6 – this is the Internet Explorer shortcut for focusing the address bar. This ensures that the address bar is focused when you enter the DoAlways section.
Then you can type in the web address and be sure it is entered correctly – problem solved!