I have a queue with a Retry Count of 3. In my process, if a System Exception occurs, I want to add a row in my report indicating the failure.
The challenge is: if I add the Add Data Row activity inside the System Exception sequence without any condition, it will add the same row 3 times because of the retries.
What condition or approach should I use so that the status is added only once to the report, regardless of the retry attempts?
hi, @Rizwana_KM
i think that happens because the queue item is retried multiple times so your reporting step also repeats. you have to log the failure only when the transaction reaches its final attempt.
you can check the RetryNumber property of the TransactionItem
example: if TransactionItem.RetryNumber=TransactionItem.RetryMaxNumber
then Add Data Row to your report.
Hello @Rizwana_KM You can use a int type counter variable initialise it before the retry and then inside the retry you can use if condition with counter.equals(3) so in then block you can use add data row byt this is static so the number of time you’re retrying then that number you have to out in condition also you can log the error in retry activity and use add data row outside the retry activity so it will write the data only once after retrying the activity.
If you are using excel data row as a transaction item, then below approach works for you.
In SetTransactionStatus.xaml. You need to delete the IF block----> If TransactionItem is a QueueItem (System Exception). Also need to add new IF block with config as shows in image.
use an if condition inside the system exception to check if - transactionitem.CurrentRetryNumber equals the max retry count (3). only add the data row when this condition is true, so the failure logs once after final retry. this prevents duplicate entries during retries.
If helpful, mark as solution. Happy automation with UiPath