Approach for reporting status of bot's work

Very often in business scenarios it is required that bot processes loads of Queue Items and at the end (eg. in End Process section in ReFramework) needs to report the results of processing. Usually it’s all about correct variables management - in case some QIs fail, are not processed or are left in progress, we struggle with passing relevant status.

The most basic solution is to create a simple status file (eg. Excel) and save the results per each QI. It requires very frequent writing of the data to report files.
However, you may want to consider an alternative solution based solely on Orchestrator.
The assumption for the solution is the use of ReFramework by UiPath, but it can be modified accordingly in other setups.

Business scenario used for the purpose of this tutorial:
Bot downloads list of all cashflows from a couple of banks and categorizes them. One cash flow is one queue item.

You should start by initializing a global DateTime variable dtmBotStart. It should be created in Initialization, but only in the 1st run part.


It will be used for obtaining QIs from Orchestrator and filtering only those QIs that have been added and processed during current run. Please mind that it might need to be adapted differently in case you assume your bot can process old QIs, already existing in the queue (apart from those added during current run).

Moving to End Process:
After the bot finishes its work, you want to check if the whole run was successful, including QI statuses you need to create the following component.
Start with initialization of all needed variables:

  • boolRunSuccessful indicates if the whole run was successful (in my scenario run was successful only if all queue items were successful).
  • lstQueueItems is a list containing all QIs that have been processed during this run.
  • dtQueueItemsStatus is a data table that contains all QIs with their TransactionItem.Specific content and the results of processing.
    image

In the next step, you should obtain all QIs from Orchestrator. It is important to define correct filters (which depend on business needs - which scenarios are seen as a failure) and filter by date (since you only want to get queue items from the current run):


Abandoned, retried and deleted QIs are out of interest in my case, but it may happen that you do need to report it.

Having all QIs saved in a variable, you can iterate through this variable and analyse all of the queue items if any of them have failed and why:

For each specific status you may want to obtain other information or insert a different status:
Successful:


Left in ‘New’ state:

Left in ‘InProgress’ state:

System Exception - you can get System Exception message by typing qi.ProcessingException.Reason:


Business Exception - the same as in System Exception:

In case there is any queue item with status New, InProgress, SystemException or BusinessException, I mark boolRunSuccessful as False since it means at least one thing was not processed end-to-end.

At the end, you have the table that contains whole history with detailed information of what have been processed:

I hope you will find this helpful in your automation since it can really make the reporting of bot’s work easier!

Happy Automation :slight_smile:

1 Like