Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

When New Email Arrives - Complex Filter for Subject - Trigger Conditions with and or

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

For the trigger when a new email arrives,

I am trying to do a complex filter.  Not sure if it is possible.

Below is what I have, and I am receiving an error in syntax:

The power flow's logic app flow template was invalid. The template language expression 'or( startsWith(triggerOutputs()?['body/subject'], 'WFM: OOF Change for'), @And( startsWith(triggerOutputs()?['body/subject'], 'WFM: Schedule change request for'), contains(triggerOutputs()?['body/subject'], 'approved') ) )' is not valid: the string character '@' at position '74' is not expected.

 

For the trigger, I am going into Settings and doing Trigger conditions.

 

I want to look for 2 things, so I need an or.  but the second pieces involves an "and".

 

I want to check for messages that start with WFM:  OOF Change for

or

for messages that start with WFM: Schedule change request for AND contains approved.

 

 

@OR(
startsWith(triggerOutputs()?['body/subject'], 'WFM: OOF Change for'),
@and(
	startsWith(triggerOutputs()?['body/subject'], 'WFM: Schedule change request for'),
	contains(triggerOutputs()?['body/subject'], 'approved')
)
)

 

 

  • lardo5150 Profile Picture
    Microsoft Employee on at
    Re: When New Email Arrives - Complex Filter for Subject - Trigger Conditions with and or

    the above is working now.

    i was filtering on the wrong folder.

  • Verified answer
    lardo5150 Profile Picture
    Microsoft Employee on at
    Re: When New Email Arrives - Complex Filter for Subject - Trigger Conditions with and or

    I have tried the below, but it is not firing.  i am no longer getting an error though.

     

    @Anonymous(and(startsWith(triggerOutputs()?['body/subject'], 'WFM: Schedule change request for'),contains(triggerOutputs()?['body/subject'], 'approved')),startsWith(triggerOutputs()?['body/subject'], 'WFM: OOF Change for'))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1