I wanted to download email attachments from outlook. The Email ID is not a hardcoded one. So i am using input dialog activity to get the email id from the user. The problem that i am facing is if the user has entered the correct email id i should download the attachments from the inbox, But if the user has not given the correct email id then the BOT should ask the user to enter the email id again. I’m struck please help
What condition should i give in the flow decision?
May I suggest you use UiPath Forms to accept user input? Not only it makes for aesthetically pleasing user experience, but it also offers validation capabilities.
If UiPath Forms is not an option for whatever reason, then you could use the same regex to validate user input from message box, using a do-while loop.
>> Get user input
>> Match against regex (Is Match activity)
While Is Match results in FALSE
This loop will only exit when the user enters a valid email.
Although, showing the error message right there on user form is way better in the interest of time and good user experience. So again, UiPath Forms is the way to go!
You can move the “Get Outlook Mail Message” activity before the decision, and add it in a Try Catch activity. In the Catch part, if the email could not be retrieved, you can add a flag (a boolean variable) to be used in the decision, in order to go forward with the processing, or ask the user again for the email id.
Also, my suggestion is to not Throw the error using the “Throw” activity, because this will end the processing. Better to show a message box to the user containing an informative message to the user. You can also add the exception message from the exception caught in “Catch” part, to the text in the message box.
And if you want the user to have the option to stop the process in case of error, use a cancel button in the input form.
In case “correct email id” refers to the format of the the id, then the solution suggested by @RPAForEveryone is a very good approach.