cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Trigger a flow when an email arrives from an specific sender

Good Morning all, Hope your days are going well.

 

I need to create a flow that checks if the "From" email address contains either "outlook.com, gmail.com" etc and update a value based on that email: If its gmail then add A if it's outlook then add B. I was able to do this having multiple nested conditions, but the flow is too wildy with so many steps, is there a way to simplify it with an expression? If "From" contains "value" then add "this value"

 

Thank You!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Trigger a flow when an email arrives from an specific sender

Hi @ DemoMan,

 

I have made a test on my side,please refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Compose as below:

if(or(contains(triggerBody()?['From'], 'outlook.com'),contains(triggerBody()?['From'], 'outlook.com')),if(contains(triggerBody()?['From'], 'gmail.com'),'AE','BE'),'CE')

When an email arrives from a gmail.com,the flow would write AE to the "SubmittedRole" column,

When an email arrives from a outlook.com,the flow would write BE to the "SubmittedRole" column,

When an email arrives either from"outlook.com" or "gmail.com",the flow would write CE to the "SubmittedRole" column.

 

Please let me know if your problem could be solved.

 

Regards,
Alice Zhang

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: Trigger a flow when an email arrives from an specific sender

Hi @ DemoMan,

 

Could you please share a screenshot of the configuration of your flow?

 

Could you please explain more details about the "If its gmail then add A if it's outlook then add B" that you mentioned?

 

You could refer to screenshot below check if  "From" email address contains either outlook.com or gmail.com:

Capture.PNG

 

Or you could efer to screenshot below check if  "From" email address contains either outlook.com or gmail.com:

Capture.PNG

 

 

 

Please let me know if your problem could be solved.

 

Regards,
Alice Zhang

Highlighted
Helper I
Helper I

Re: Trigger a flow when an email arrives from an specific sender

Hi @v-yuazh-msft

 

Thank you for your assistance.

 

 

Could you please share a screenshot of the configuration of your flow?

My flow looks pretty much as yours, the trigger is "When an email arrives on a shared mailbox" and then the followin conditions:

 

Capflow.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

As you can see is the same idea as your second example, only that my flow continues to create an item based on the values from the email.

 

Could you please explain more details about the "If its gmail then add A if it's outlook then add B" that you mentioned?

 

What I'm trying to accomplish is (if possible) replace all the nested conditions with an expression that would:

1: check if the "From" email address contains either "outlook.com" or "gmail.com" or etc

2: based on that email address write a value to my "SubmittedRole" column (highlited) for example if the email address contains "gmail.com" then write AE to the "SubmittedRole" column, if it contains "outlook.com" write a different value and so on.

 

Right now the flow is working with the conditions I have as is, but I was hoping there was a way to streamline the flow by getting rid of all the nested conditions and have left steps so that it is easier to replicate.

 

Thank You for your help

Highlighted
Community Support
Community Support

Re: Trigger a flow when an email arrives from an specific sender

Hi @ DemoMan,

 

I have made a test on my side,please refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Compose as below:

if(or(contains(triggerBody()?['From'], 'outlook.com'),contains(triggerBody()?['From'], 'outlook.com')),if(contains(triggerBody()?['From'], 'gmail.com'),'AE','BE'),'CE')

When an email arrives from a gmail.com,the flow would write AE to the "SubmittedRole" column,

When an email arrives from a outlook.com,the flow would write BE to the "SubmittedRole" column,

When an email arrives either from"outlook.com" or "gmail.com",the flow would write CE to the "SubmittedRole" column.

 

Please let me know if your problem could be solved.

 

Regards,
Alice Zhang

View solution in original post

Highlighted
Helper I
Helper I

Re: Trigger a flow when an email arrives from an specific sender

Thank You very much Alice, this is what I was looking for.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (9,901)