cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DemoMan
Level: Powered On

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 Team
Community Support Team

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 Team
Community Support Team

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
Level: Powered On

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 Team
Community Support Team

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
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 90 members 4,270 guests
Please welcome our newest community members: