Skip to main content

Configure waiting for an email reply scenario in UiPath

Sometimes, we come across the situation where we have to send the email to some group and then they will cross check some data or fixing from their side and reply back on the same email with their approval, then only you have to proceed forward. In that case we can configure our code in such a way that it will check the outlook emails to wait for approval email to come.

We are assuming that currently the wait time is 10 minutes and after that we will send the email again to the team/group and we will keep sending the email until they provide us approval. So, accordingly you can change your scenario or you can do little changes in this easy logic.

The whole logic will look like this, its very simple and easy to understand.

1. First send the email to the concerned team and set the time after 10 minutes in one variable. Now we will check this variable with the current time to get to know that we have waited for 10 minutes or not.

2. Then we will assign on new List of Mail messages and will get the emails from outlook using get Outlook activities and use linQ query to check the same subject line again.
LinQ: List_MailMsg.Where(Function(x) x.Subject.Replace(" ","").ToLower.Contains("Subject"))(0)
3. Either your list contains some data after LinQ otherwise it will give you Nothing. If it providing you data that means they already replied you can start processing further or maybe you can check email body for further inputs according to your process. Otherwise we will compare the current date with the date we set in first step whether 20 minutes are over or not.

4. For this we will take Assign: 
vStatusInt = DateTime.Compare(DateTime.Now,vDtime)
vDtime: Variable we set in first step (+10 minutes).

If vStatusInt=1, that means your 10 minutes are over, and you have to send one reminder email again.

Else, You have to check the mailbox again for the right email, that means you have to go back or connect 2nd step from here again.

Conclusion:
You can change according to your need, but the logic remains same. I hope you understand. Try to implement yourself, only outlook and UiPath required as your pre requisite.

Happy Automation.

Comments