I have a process to Login into a carrier site using MFA login.
I have 3 sequences
1.) Main
2.)Two factor authenticaton
3.)get OTp code
Whenever the bot is not picking up the email in first attempt -
Howeover in my Two factor authentication sequence , I have a Pick branch activity
one branch : with check app state activivty-> it checks whether my screen appeared ? if appeared it will simply print a log message and process closes
another pick branch branch-> has a check app state for the condition when a wrong verification code is entered by the bot → then it goes to run the action part of the pick branch
action part has the retry scope → retry scope should be done two times or unless my condition of counter retryCounter>=2 is met , but it still keeps on running. , and doesnot throw a exception
The incrementation of in_retrycounter seems a bit odd. If you increment it inside Twofactor.xaml, the direction should be “in/out”, as you are changing the value. Otherwise you should first increment it in an assign, before passing value to the other workflow.
When an exception is thrown from inside Retry scope, a retry is triggered until the maximum amount of retries is reached. It seems are using a recursive pattern, which generally is not that advisable with workflows.
I suggest to move away from recursion. Don’t invoke the same workflow inside the Retry scope. Not sure of your requirements, but maybe you want to have the Retry on the level of the workflow which invokes your “Twofactor.xaml”. Or as the topmost scope inside it.
Also not sure if you noticed, but Retry scope has the amount of retries in the properties section. You could place 2 there instead of checking the retrycounter in the Condition (do you always need the 2 retries or are you ok if the action is done successfully on the first try?).
Just configure the maxretry in the retry scope and remove the condition…
As per your condition even if it is successful it would retry as the condition is not met…you can leave the condition empty…that should not be a problem
As many experts already discussed on this, no need to complicate the logic here!
No need of If condition as Retry scope already have MaxRetry property use that.
No need of Try Catch as every exception will trigger a new try if MaxRetry doesn’t exhausted.