cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DemoMan
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

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
v-yuazh-msft
Community Support
Community Support

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

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

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

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

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,613)