Getting "Max # of retries" for an Orchestrator Queue from Studio


#1

Hi, I have a question regarding Orchestrator queues and retries.

More specifially I’m wondering if there is a way to get “Max # of retries” (the one you set when creating a queue in Orchestrator) from within the UiPath Studio ReFramework. I’m aware that there in the Config.xls is a MaxRetryNumber constant, but to my understanding this Constant is only if you are not using Orchestrator queues… right?

When digging a bit in the ReFramework I found this check under Robot Retry in SetTransactionStatus.xaml:
cint(in_Config(“MaxRetryNumber”))>0. Where is the MaxRetryNumber initialized? Does it come from the Excel-Config or from the Queue?

The reason I’m asking is that I want to send an email when something goes wrong, but only on the final retry.

Right now I’m doing like this:
if TransactionItem.RetryNo = 1 (I have set the max retry for the transaction to 1 in Orchestrator).
– Send Outlook Acitivity

But perhaps there is a better way to do this than hardcoding the max retry no?

Thanks in advance.


#2

Hi. I think you answered your own question, because it’s in the Config.xlsx file (or should be) as a constant. There should be another variable built in the Framework that increments by 1 each time an exception occurs so that variable should be compared with the constant ( in_Config(“MaxRetryNumber”) ).

The condition could look like this: retryNumber <= cint(in_Config(“MaxRetryNumber”))
You might need to use the transition that exits from the current transaction, which should have a condition like this: retryNumber > cint(in_Config(“MaxRetryNumber”))
then you can do a Send Outlook activity

So it enters that transition if it has met the maxRetryNumber, and perform additional tasks like sending the email. This transition might already be in the ReFramework.

Also, retryNumber should be re-initialized to 0 at the start of each new transaction, if it isn’t already.

I hope that helps, but I am more of a visual person and am not exactly looking at the ReFramework as I post this. I’m hoping I can atleast provide the basic understanding of how the retry logic should work.

If you have additional questions, I can look into it further, and also if you could provide some screenshots or something, that will help us more visual people :smiley:

Regards.


#3

Thank you for the fast reply Clayton. Sorry if I formulated myself badly or if I misinterpred your reply now, but english is not my primary language.

The constant MaxRetryNumber in Config.xlsx is 0, as it should be when using Orchestrator (the comment for this constant says “Must be 0 if working with Orchestrator queues. If > 0, the robot will retry the same transaction which failed with application exception. Must be integer”).

In Orchestrator I have set Max # Retries like this:
Orchestrator

And this works, the transaction is retried once… and on the last retry I’m sending a mail by checking if TransactionItem.RetryNo = 1… which also works fine. The thing I don’t like is hardcoding “1”. But if I understand you correctly I can just do like this instead:

TransactionItem.RetryNo = cint(Config(“MaxRetryNumber”))

I will test how that works. Thanks again Clayton. :slight_smile:


#4

You can create another constant in your Config.xlsx and use that instead. Or just use the MaxRetryNumber, but you’ll need to adjust your ReFramework slightly.

In any case, “MaxRetryNumber” in cint(Config(“MaxRetryNumber”)) should be found in the Config.xlsx file, and you can use any name for it in the Excel file.

Since you are using the Queues, I see that .RetryNo represents the Queue retry I’m assuming, so what you can do is create a transition from the Process state to the Exit state with the condition that you showed right there to compare .RetryNo with “MaxRetryNumber”, then place your Send Outlook inside that transition under the condition.

Maybe that answers it better.

Regards.


#5

That sounded like an elegant solution using transitions, I will try that. Thanks again you for your time Clayton, best regards and have a nice weekend. :sunglasses: