Hi all,
I am new to Uipath. I want to read the body of all unread messages in outlook mail one after another. And wants to check the condition for only two mails.
For example : if first mail contains body as “success friend” and the second mail
body contains as “success unfriend”.
Now what i want to do is first i want to read first mail and check whether the body contains “success friend” and next i want to read second mail and check the body contains “success unfriend”. After that i want to display message as “Both mails are success”.If i did not receive body like that in both mails i want to display as “Both are failed”. If any of the body does not contains the message as specified then display the message which does not works properly whether it may be “unfriend failure” or “friend failure”.
@Bindhu you can use if condition like item.body.contains(“success friend”) or item.body.contains(“success unfriend”) if any mail body contains these values it goes to then section there you can maintain a message box as both mails are success if it don’t contain those it goes to else section there maintain message box as both are failed.try this it might work for you.
If it fails then it goes to else case right. but i want to display a message in which case it fails whether in “success friend” or “unsuccess friend”. If both fails i want display “Both Fails”.
@Bindhu if that is the case use if condition and give only condition like item.body.contains(“success friend”) if it finds it goes to then section there you can give finds the success friend,say if that body don’t contains success friend it goes to else section there use one more if condition and give **item.body.contains(“unsuccess friend”)**if it finds that it goes to then section there give message box as finds unsuccess friend if it don’t finds success and unsucess friend it goes to else condition there give message box both fails.
so now as you can see initially it looks for success friend in first condition if it finds that it will give you message box as finds the success friend
-if it don’t find the success friend it goes else condition there as we mention one more if condition for unsuccess friend if that contains unsuccess friend it goes to then and give you message as finds unsuccess friend.
-if it don’t contains two it goes to else part of second if condition there you can give both fails.
i think this will satisfy your above requirement.plz let know if any thing needs.
Both Mails are different i want to keep message box out side of for each loop.If i kept there itself it printing two times.I want to check two mails one after the other and finally based on the result i want to display the message as success or failure in any of the case or failure in both.
@Bindhu if that is the case use if condition as item.body.contains(“success friend”) or item.body.contains(“success unfriend”) if it satisfies the above condition it goes for then section right.now create a integer variable and in then section use assign activity and give like this say the int variable name is counter.then in assign activity counter=counter+1give like this.now outside the for each loop use a if condition like counter=2 if it satisfies it gives the output as both success and unsuccess successful.
-now back to the for each loop,here create one more integer variable say encounter with default value 0.in else condition give like this encounter=encounter+1
-below it use if condition as encounter =2 it goes to then section there mention both are failed,in else condition use write line as item.body.
@venkatmalla6 It working well.But it does not displaying the message in which case it fails whether in “Success friend” or “success unfriend”.it gives output like this.