cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Any alternative to multiple If Condition control contains checks

Getting back to making flows after a long break. I am building a flow for when an email alert comes in. These emails pertain to multiple clients. I want to send an email to the client when I receive an alert from our system. Currently, I have it to trigger when a new email arrives, then it checks the subject for Client A. If Client A is in the subject, then it sends my email. If not, it checks for Client B and the process repeats. I am not very far so I considered switching it to use parallel branches for the condition control but it is still the same amount of work.

 

Is there a better way to do this than a long branch of condition controls and if yes/no actions. It would be great if there could be a two column table as my condition that scrapes the subject for "Client Name" then associates that with an email to send to.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Any alternative to multiple If Condition control contains checks

HI @MitchC3 I think branching is your best option. I have some very large flows triggered by Microsoft Forms responses and saving to SharePoint lists. Depending on the issue type  - and there could be 10 or 12 - I have built a condition but had them in parallel branches with nothing in the If no red channel of each. It works fine but until we can easily copy & paste you have to build it. If there is a better way I'd also be interested to hear it, but at the moment I don't think there is.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

View solution in original post

Highlighted
Dual Super User II
Dual Super User II

Re: Any alternative to multiple If Condition control contains checks

How predictable is the formatting of the subject line? Could you use a Regex match to pull the client name out of the Subject line and store it as a seperate variable? I've done this to extract email addresses from text in the past by getting the characters in front of and behind the '@' sign.  Then you can compare just the client name.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

Re: Any alternative to multiple If Condition control contains checks

HI @MitchC3 I think branching is your best option. I have some very large flows triggered by Microsoft Forms responses and saving to SharePoint lists. Depending on the issue type  - and there could be 10 or 12 - I have built a condition but had them in parallel branches with nothing in the If no red channel of each. It works fine but until we can easily copy & paste you have to build it. If there is a better way I'd also be interested to hear it, but at the moment I don't think there is.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

View solution in original post

Highlighted
Dual Super User II
Dual Super User II

Re: Any alternative to multiple If Condition control contains checks

If you are checking for a value in the same field for each IF/Then you could replace all of them with a Switch.  Switch essentially tests a single value and sends the system down a parallel path for each different value that can be found.  There is also a Default to catch any cases that don't match one of the other paths.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Advocate II
Advocate II

Re: Any alternative to multiple If Condition control contains checks

@Pstork1 A switch would be great if I could change the case looking for equals to contains. Every email subject is pretty different with a ticket number and issue response but they contain the client name it pertains to which is the part I am looking for. I suppose I could parse the subject for the client and make them into variables if they client always appears in the same format.

Highlighted
Advocate II
Advocate II

Re: Any alternative to multiple If Condition control contains checks

@RobElliottI don't think it matters but I usually put a terminate action to class the flow as cancelled instead of leaving the if no channel empty.

Highlighted
Dual Super User II
Dual Super User II

Re: Any alternative to multiple If Condition control contains checks

How predictable is the formatting of the subject line? Could you use a Regex match to pull the client name out of the Subject line and store it as a seperate variable? I've done this to extract email addresses from text in the past by getting the characters in front of and behind the '@' sign.  Then you can compare just the client name.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Advocate II
Advocate II

Re: Any alternative to multiple If Condition control contains checks

@Pstork1It appears to always be in the same spot but from my understanding, combining the regex match with the switch does not really change the overall branching of the flow. It looks like I will have to create similar actions for each client under each switch or branch regardless of the method. Thank you for your input but I think I will just continue to branch out with parallel conditions to check the subject.

Highlighted
Dual Super User II
Dual Super User II

Re: Any alternative to multiple If Condition control contains checks

You wouldn't be combining the Regex with the switch.  You would be using the Regex to extract the customer name from the Subject line and storing it in a Variable.  Then you would do the switch on that variable because all the variable would contain is the Client name which would allow the switch to use equals as the operator instead of contains.

 

But parallel branches with conditions will work too.  Essentially that is what the Switch does.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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 (7,874)