Hi Guys,
Need small guidance as how to use this activity when I need to retry get outlook mail activity till it finds some mail. So once the BOT find the mail then it should come out of the scope.
Thank you
Hi Guys,
Need small guidance as how to use this activity when I need to retry get outlook mail activity till it finds some mail. So once the BOT find the mail then it should come out of the scope.
Thank you
There may be a more elegant way, but I would do something along the lines of this:
While(mailExists == false){
mailExists = checkMail();
}
Just toss it in a while loop, use a boolean value that while false tells it to keep searching for the mail item. Once it finds the mail item (i.e. through the checkMail() function/activity) set the boolean to true which will end the loop.
Alternatively you can just set the loop to something like While (1 != 2) {}
and break the loop when you find the mail item. You could add a delay between attempts as well if that is a concern as well as adding an upper limit to the number of times it checks for the mail item.
But if it did not find the mail then it will be in the loop.
Thats y was thinking to use Retry scope, to try only 3 times
You could easily implement a counter into the loop with an if statement to check at the end of it to throw an exception or to just break the loop.
count = 0;
While (mailExists == false){
mailExists = checkMail();
if(count >= 5){ //Designate number of attempts here
throw(new System.Exception("XYZ"); //or break;
}
count++;
}
Since there is no Break activity for While loops in UiPath, you could write the same like this:
count = 0; While (mailExists == false Or count < 5){ mailExists = checkMail(); count++; }
Thanks, could u guidew me how to use the same using retry scope activity
Thanks a lot…haha…I know that