As everyone else in this thread suggested, having a state-tracker/managing states using a SharePoint list or Dataverse would definitely work. But there is a clever way you can achieve your requirement in a single flow as well.
Here is my suggestion on how you can send a notification on Teams when all three emails from the sender arrive without needing to configure a state-tracker:
- Create a flow and use the "When a new email arrives (V3)" trigger. Configure the "From" and "Subject Filter" parameter of the trigger. Enter the email address of the sender and for the subject, add some line that is present in all three emails. This will ensure the flow only triggers for one of the three valid emails that you are looking for.
- Use the "Get emails (V3)" action, but apply a filter query. The idea here is that once you have verified the new email is one of the three emails that you are looking for, you check to see if, on that particular day, there are other emails from the same sender with other subjects added to the filter query with the OR operator.
- Add another condition to check for the number of emails returned from the previous step.
- If the number is exactly equal to three, send the notification and terminate.
- If the number is less than three, do nothing.
What this flow does is:
- When you receive the first valid email, it checks to see if all three emails arrived on that particular day. Only one email is returned, so the flow does nothing.
- When you receive the second valid email, it checks to see if all three emails arrived on that particular day again. Only two emails are returned, so the flow does nothing.
- When you receive the third valid email, it checks for all three and finds all three on that particular day, so it sends the notification on Teams.
- For any other email received that does not match the subject or did not come from that particular sender, the flow does nothing.
This lets you achieve your requirements without needing to constantly manage states.
Here are some screenshots on how you can set something like this up:
Overall flow:
Trigger: When a new email arrives (V3)
Note: Ensure you put a subject filter that is present in all three emails. I sent three emails with the subjects, "ONE OF THE THREE EMAILS: FIRST", "ONE OF THE THREE EMAILS: SECOND", and "ONE OF THE THREE EMAILS: THIRD", which means having "ONE OF THE THREE EMAILS:" as a subject filter would trigger for all of them. In case your subjects are all unique, you can use the Filter Query parameter as well to use the OR operator.
Action: Get emails (V3)
Note: Make sure you use the same Subject Filter (or Filter Query in case subjects are all unique) and the same From value as your trigger.
Action: Condition
Expression:
length(outputs('Get_emails_(V3)')?['body/value'])
is equal to 3
Action: Post message in a chat or channel
Here are the three times the flow triggered:
And the message received on Teams only when the third email arrived:
Let me know if you have any other questions.
Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item.
If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like! 🩷