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
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
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

DemoMan 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

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

DemoMan 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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (2,465)