Showing results for 
Search instead for 
Did you mean: 

Trigger conditions - filling the information gap

One of the commonly used triggers in a flow is "When a new email arrives".

The set of fields is very simple and it might be difficult to catch particular and only the one mail you so much care about. 
I have seen people building flows that are triggered on more emails than necessary and have huge conditions inside, testing if the mail which triggered the flow meets their requirements. It is not an efficient use of Power Automate to say at least.


There is a more simple way, a bit hidden from your eyes. You can use Settings and Trigger Conditions.
You can put several condition expressions, and you may wonder what an operator is used between them? You won't know unless you test it (unfortunately). I have already tested it for you and the answer is AND. So each line of Trigger conditions must return TRUE in order to execute the trigger.


Before we jump into building conditions there is a good article I can recommend you read: Power Automate Trigger Conditions made EASY by @MattWeston365. It is a good intro to how you can actually test your conditions.


Further down I will explain to you how to build trigger conditions

When building trigger conditions start with @ followed by functions. You can find the list of available functions in expressions in the Reference guide to using functions in expressions for Azure Logic Apps and Power Automate

A simple expression to test if the subject of the mail contains the word "Update", would look like:





@contains(triggerBody()?['subject'], 'Update')






If you would like to test if the subject of the mail contains the word "Update" or "Weekly", then the expression would be like this:





@or(contains(triggerBody()?['subject'], 'Update'),contains(triggerBody()?['subject'], 'Weekly'))






How about checking the subject and the mail body? To test if the subject of the mail contains the word "Update" or "Weekly", and the body contains a string "Community", the expression would look like this:





@and(or(contains(triggerBody()?['subject'], 'New'),contains(triggerBody()?['subject'], 'Closed')),(contains(triggerBody()?['body'], 'Community')






It is getting more complex so let me visualize it using the conditions within the flow and converting it into trigger conditions.



(body contains "Community"),


(subject contains "Update"),

(subject contains "Weekly")




To better understand those conditions, here is a real-life use case.

In IT Operations there is a SCOM server that monitors the infrastructure. One of the methods for subscribing to Alerts and Warning events notification is by sending them out by mail. There was some specific sort of mails coming from SCOM which should be checked and based on them an action should be triggered. 

The requirement was to catch all mails with Severity 2 and Priority 1 or Severity 2 and Priority 2. In addition, the subject should contain words: 'New' or 'Closed'. Severity and Priority are in the body of the message.

Here is the condition in a more readable format. 


'Severity: 2' AND  'Priority : 1'


'Severity: 2' AND 'Priority: 2'


subject contains "New" 


subject contains "Close"


When I first enter the flow I saw this condition:




Pretty complex, right? And the flow was running on every mail from hundreds coming from SCOM every day. 


Here is how you can do it using trigger expressions

Remember that there is an AND operator between each expression. Having this in mind let's break the above into two trigger expressions lines.

In the first expression, we will focus on the Severity and Priority. In the second expression, we will test a subject.

The first expression will look like this:





@or(and(contains(triggerBody()?['body'], 'Severity: 2'),contains(triggerBody()?['body'], 'Priority: 1')),and(contains(triggerBody()?['body'], 'Severity: 2'),contains(triggerBody()?['body'], 'Priority: 2')))






Add a second expression:





@or(contains(triggerBody()?['subject'], 'New'),contains(triggerBody()?['subject'], 'Close'))






Combined in the flow, in the trigger condition this will look like this:



This way the flow has been triggered a few times a day compared to some hundred times before. 


Here is a little challenge for you!

Based on this article. would you be able to convert this example into one expression? If yes, share it with us within the comment below this article. 



Sometimes pictures and samples can explain a complex topic better than a thousand words. I hope that in this case, my example helped you to understand how to build trigger conditions in your future flows. If not, let me know and I will try to explain it better. 

If you recently build an interesting condition, please share it with us in the comments below, so more can get inspiration from your work. 


@Michal ,


Thank you for this rundown on trigger conditions. Very helpful!


would the combined expression look like this?


@and(or(and(contains(triggerBody()?['body'], 'Severity: 2'),contains(triggerBody()?['body'], 'Priority: 1')),and(contains(triggerBody()?['body'], 'Severity: 2'),contains(triggerBody()?['body'], 'Priority: 2'))),or(contains(triggerBody()?['subject'], 'New'),contains(triggerBody()?['subject'], 'Close')))


Thanks, again!



Hi Michal,

How to build a trigger condition is described in detail. thanks for sharing this value able information I am really impressed.



Hi @Anonymous 

👍Yes, you did it! 💪

Have you found my article helpful?

GREAT article. Thanks, Michael. 

One tip I recommend for shared flows: 

Always add a comment to the first action to say "Trigger condition: [insert plain language description of the trigger condition here.]"


This is important for someone coming after you who needs to understand why the flow may or may not be triggering, and how it works. 🙂


Andrea Mondello

Great Article!

Juan Simon

Great information!


I got this running on a shared mailbox, to create a Planner task when people email with a request for quote.


Looks like the text is case sensitive. I need to make one for 'quote', one for 'Quote' and one for 'QUOTE'. Also for different syntax for quotation and even RFQ. 


Any solution to make this trigger not case sensitive?


Best regards,

Stein Jone Hovland

Hi @fideco 

Take a look at the  Reference guide to using functions in expressions for Azure Logic Apps and Power Automate. The first example at this page is a function which returns a string in lowercase format. 




Just use that in your condition and life becomes much easier. (I hope 🙂 )


If you don't know how to use it, here is the example from my article. It converts to lower case whole subject and whole body and checks the result if it contains a specific words.


@or(contains(toLower(triggerBody()?['subject']), 'new'),contains(toLower(triggerBody()?['subject']), 'close'))





Thank you so much @Michal! It just works now. 






This is great information! I'm still failing on how to implement a trigger condition that looks at the email attachment and only proceeds if it's PDF. 


This is not working: 

Any suggestions?

Hi there, is it possible to use this to filter subject inside the attachment instead? 

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: and twitter I also write at, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – Youtube channel -