I need some help with my “do while”-Activity.
In my process the bot starts a report in SAP. Because it is possible that SAP open an extra-Window with a warning inside while loading the report I built a ‘do while’ with an try catch to click the continue button until the report is ready (check if a new SAP-page without a specific icon on it is open) to continue with the rest of the process. It works fine!
But now I need a warning (per mail or something else) if the loop is due to an unknown error in an real endless loop.
Is there a way to build in a warning when this loop through the report takes longer than 2 hours?
If you do nothing, does the Continue button disappear when the report is ready? If so, you should watch for the button (or something else) to disappear. Or you could wait for something on the screen to appear - whatever appears when the report is ready.
Then everything depends upon the timeout of the Check App State activity, and it’ll throw an error if the timeout expires.
I think you have a few ideas and thoughts, hoping I grasp your question correctly.
Your Try-Catch only works if an error occurs, since you’re stuck in an infinite loop, it never errors out.
I am thinking you may need a Parallel activity, that allow you to look for different screen activity at the same time. You can even set it so that one of the parallel activities generates a throw, invoking the Catch part of your Try-Catch. By defining the error type you can customize your error message that you can incorporate into an email alert.
You can also use the loop to check for something that doesn’t exist while report is running but does exist when it’s done. than add a count for each loop. If you want it to check every minute (use Delay activity to time it approximately right, or the Target.Timeout to 60000 functionality.) if total count > 120, set loop boolean to stop to True and you are not interrupting the otherwise infinite loop. Include that if count > 120, do a Throw Activity, so you’re using the Catch to send the message you mentioned.
Parallel doesn’t actually run the activities inside it in parallel. They’re still executed in order. It’s just that the automation doesn’t continue to the next activity until all sections of Parallel have completed.
I have used a Parallel-Activity. On the Left is a Do While to close an extra window which can appear one ore more times during the report
On the right is a Do While to check the time the report runs. When it needs more than x minutes it should throw out an error (BusinessRuleException).
The whole parallel is put in a TryCatch to bring a Message Box then the error is occured
Problem 1 = The Error was thrown after the first Appearing of the window I have to close and not after the time I want. The Process should throw the error e.g. 5 minutes after starting report, no matter the report is ready or not or if there is a window to close
Problem 2 = I get the error:
instead of the Message box I want. Where is my mistake?