Get an email and then terminate after you've found the right one

Hi,

I had some issue with designing a robust email reader automation.

I am trying find an email with a particular subject by using “for each” function to go through top 100 emails. And, I want to exit the loop immediately after it found an email which met the condition. Assuming there are more than one email which met the criteria set. At the same time, I would not want to have nested IF in my sequence workflow.

The reason why I want to get out of the loop is that each email contains its own data and I do not want it to overlap the data assigned to a variable.

Hi @tzekailim,

do you want to get all e-mails matching your criteria, or only the first one?

If you want all e-mails matching a certain criteria, you should create a list before iterating over the e-mails. Inside the for-loop check for the criteria. And if they match add the e-mail to your list of e-mails.

If you only want to get the first e-mail matching your criteria, use an if-statement and an break activity.

BR,
Mike

1 Like

Just the first one email.

Thanks for answering, I will try it out.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.