Hello community,
I want to share with you some simple guidelines and considerations about using queues and adding transaction items. Adding the right data will be very helpful in different perspectives. The main idea is that you can track your transaction and have all the necessary data in terms of support, monitoring, troubleshooting and it could also be a base model for future analysis.
- Use Transaction Reference
Add transactions to queue orchestrator with reference. Reference should be a unique identifier, if you don´t have a unique value per transaction you can use combination of values that will generate unique key. If you can add a short day as reference will be better. Don´t use long transaction reference (UiPath Limitation).
Example for a process that generate daily report for different country:
[Country Name ISO] + [Country Region] + [Current Date]
USA Americas 12-14-2
Tip: Surround with Try Catch “Add Queue Item” and include your exception handling (Duplicate References, Timeout)
- Use Output Field for relevant information
Of course you can have a large level of logs that describe your automation, but let’s think about the scenario where you have thousands of transactions per day and you need to find a specific log during the day, it could be very time consuming right? For your success transactions, you can provide relative information that could be used for insights, troubleshooting, or monitoring without checking logs. Design your outputs based in your process calculations, output paths, status etc.
For example, in a business process that be in charge of generate reports from covid and vaccinations, we are doing calculations of numbers of vaccines types used, getting a hash value, save report in specific location and check status for create and send report.
- Use Details in Transactions with Exceptions:
Provide additional information of transaction that could be useful to track scenario, verify input requester and inputs details. Use Exception Categories as part of the exception details (See Point 4) and provide screenshot path error in case that exist, this will be very useful to associate the transaction data and its exception screenshot.
Example:
- Create Exception Categories
Create business and application categories for your exceptions based in exception content. This will help to business and support team to understand the exception, check if it is expected exception and take decisions based on results. For example, process is receiving request with incorrect inputs, you can create “Invalid Input Data” as category. If you are getting a lot of exceptions with this category that means that users should take trainings to prepare better inputs. By the other hand, if transactions are failing about UI Element Not found, support team should apply changes in stable selectors.
Example:
4.1 Exception Category Details and Actions
Create Exception Details file that bot could read and extract exceptions message and categories, this will help to have flexible exceptions messages, will be easy to change and business can take actions depends on exceptions message. Include column unique ID.
Example:
4.2 Exception Category – Storage
Usually for Business Exception, developers use Throw Activity with new BusinessException and send message as parameter. You can use this Throw activity and send your category exception as Inner Exception.
Example:
4.3 Exception Category - Extract
Extract your exception category in SetTransactionStatus.xaml. From your inputs argument in_BusinessException, extract InnerException.
Add handle in case your exception doesn´t have inner exception:
If your exception doesn´t have inner exception, use a default exception category or “Not categorized exception”.
For application exception you can set exception category as “Unexpected System Exception” or create categories based on exception content, checking if exception contains specific keywords.
For example:
- Unexpected Data Structure Category: Exception contains “the given key was not present in the dictionary" or “was not in a correct format"
- UI Element Not Found Category: Exception Contains “Cannot find the UI element corresponding to this selector”
- API Error Category: Exception Contains “API”
- Save Data Structure in Transactions
If you have data in dictionary or data table and you want to add to transaction, it is possible using serialize object. This could avoid add multiples fields into the transaction.
Example:
- Newtonsoft.Json.JsonConvert.SerializeObject([Object])
Later in your performer, you can retrieve your object using deserialize.
- JsonConvert.DeserializeObject(of [ObjectType))([SerializeObject])
What other considerations do you implement when adding elements to the queue?