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

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

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.

 

Super User
Super User

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.
7 REPLIES 7
Super User
Super User

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.

 

Super User
Super User

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

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.

MitchC3
Level: Powered On

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.

Super User
Super User

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

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.

Super User
Super User

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 Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

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