Filter Internal Emails Using Trigger Conditions
    • Dark
      Light
    • PDF

    Filter Internal Emails Using Trigger Conditions

    • Dark
      Light
    • PDF

    Article Summary

    Using filters inside of Power Automate is nothing new. We have built-in features like conditions and the filter action, but what happens if we want to filter out information at source so that we do not process it? For example, we may have an inbox where we receive communication from inside our organization but also from outside. We want to process emails from external parties but ignore, or filter out, emails from internal parties.

    We can filter out emails by using the Subject Filter or From fields that are found in our trigger. However, this does not quite address our requirements since we can receive emails from many external parties and do not want to maintain a list of email addresses here. In addition, our Subject may vary so using the Subject Filter will not address our requirements either.
    1-Trigger Filters

    However, we can use a Trigger Condition to solve our issue. Trigger Conditions are found in the Settings experience found by clicking on the … (ellipses).
    2-settings(1)

    We now need to look for the Trigger Conditions setting and can click on + Add to add our expression.
    3-triggerconditions

    For our Trigger Condition, we will provide the following:

    @not(contains(triggerBody()?['from'],''))

    This condition will look to see if our mail domain exists as part of the From field from the Outlook trigger. We will then add the not expression to the front of it because a trigger condition needs to evaluate to true for the email message to activate a flow.
    4-expression

    We can now go ahead and test our flow by sending two emails; one from our internal mail domain that we want to filter out and one from an external domain that we want to process. To validate that our flow is working correctly, we will display the email address in a Compose shape within our flow.
    5-flow

    Once we have sent our emails, we can go check our flow Run History. We will discover that only the email from our external party is processed as we have successfully filtered out our first email through our Trigger Condition. Not only does this keep our Run History clean but it saves flows from impacting our flow quota which can reduce our licensing costs.
    6-test


    Was this article helpful?