cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Adding condition to email flow - if user = x, email = y, else email = user email

Hi,

 

I am very new to flow and I have just learned about the compose action that allows me to manipulate date formats.


I have an email flow that emails users when a new item is created in a sharepoint list.  One of the fields on the sharepoint form is responsible.  When a new item is created an email is fired off to the responsible email.


I've got a requirement though that when a responsibles email is a particular email that the new item created email should go to a shared email inbox.  Does that make sense?

 

I have a group of users that this is required for, a sales team.  The sharepoint list is an incoming call register that the customer service team work with.  They accept calls and forward customer service requests to the relevant dept / person.  When its a sales call the email is sent to sales@email.com.  Naturally the sales team is multiple users and they pool the requests and answer as they can.

 

Is there a way to manipulate the TO field in the send email flow so that if user = x, send email to sales@email.com, else send it to responsibles email?

 

Hoping there is.


Appreciate any help, and thanks in advance.

 🙂

 

Steve

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Adding condition to email flow - if user = x, email = y, else email = user email

Does this kind of flow satisfy your needs?

When some fields of newly added item is x, send email to sales@email.com, otherwise send email to responsibles@email.com

 

conditionemail.png

 

Thanks

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Adding condition to email flow - if user = x, email = y, else email = user email

I searched from workflow definition language, https://docs.microsoft.com/en-us/rest/api/logic/definition-language

 

Probably this is a solution in advanced mode: 

 

@and(@equals(triggerBody()?['user'], 'x'),@equals(triggerBody()?['user2'], 'y'))

 

 

 Thanks

 

View solution in original post

7 REPLIES 7
Highlighted
Microsoft
Microsoft

Re: Adding condition to email flow - if user = x, email = y, else email = user email

Does this kind of flow satisfy your needs?

When some fields of newly added item is x, send email to sales@email.com, otherwise send email to responsibles@email.com

 

conditionemail.png

 

Thanks

View solution in original post

Highlighted
New Member

Re: Adding condition to email flow - if user = x, email = y, else email = user email

Thats exactly what I was looking for @telu, thanks for your help.


Do you know if it's possible to put multiple clauses into the value field of a condition?


Can it be done as comma separated, or semi-colon separated?

 

Highlighted
Microsoft
Microsoft

Re: Adding condition to email flow - if user = x, email = y, else email = user email

I searched from workflow definition language, https://docs.microsoft.com/en-us/rest/api/logic/definition-language

 

Probably this is a solution in advanced mode: 

 

@and(@equals(triggerBody()?['user'], 'x'),@equals(triggerBody()?['user2'], 'y'))

 

 

 Thanks

 

View solution in original post

Highlighted
New Member

Re: Adding condition to email flow - if user = x, email = y, else email = user email

@telu You're a jedi!  Not only have you given me the solution for this one (fish)... you've also given me the link to the documentation that I was looking for in another thread (fishing rod)...  😄


Thanks mate, really appreciate your help!

Highlighted
Regular Visitor

Re: Adding condition to email flow - if user = x, email = y, else email = user email

This solution works with 2 choices, but if you have more than 5 it doesn't seem to work (Flow allows for 5 nested conditions). Any options you may have found for that? 

Highlighted
Advocate III
Advocate III

Re: Adding condition to email flow - if user = x, email = y, else email = user email

Sorry to necro an old thread, but if anyone else is seeing this and has a similar issue, one thing you could do is make a string variable that you can use to build a list of email addresses separated by ; that you use later on in your email connector. It could be initialized to empty, then you could use a switch case (a list of what to do when the value of Responsible equals certain values) that would add email addresses and a ";" to the string.

 

The pseudo-code would be something like this

 

Make an empty string emailRecipients

 

Look at "Responsible" on the item

 

If "responsible" is x, append a certain email address + ";" to the emailRecipients

 

If "responsible" is y, append a different email address + ";" to emailRecipients

 

Send email to the value of emailRecipients variable

Highlighted
Frequent Visitor

Re: Adding condition to email flow - if user = x, email = y, else email = user email

Another option is to use a Switch Control and switch on different emails .. then you can have as many as you want (well as many as you can effectively manage) and then use the default switch statement as your fall thru.

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,544)