Flow Switch - How to manage the String expression

Good morning,

I’m creating a Workflow that asks the user to choose the employee department (IT, Operations, Marketing, Finances, HR, Administration…) on a form. After, I need to perform a Switch to activate the “Active Directory Scope” with the Add group activities that add the groups of the correct department to the employee. For the moment I’m triying only with 3 of those departments to learn about how to user the “Flow Switch” activity, but after I will need to add more options to the switch for the other departments so I don’t want do it with a lot of flow decisions one after the other.

I don’t have any idea about the syntaxis I must use to determine wich case will match witch each condition. This is what I’ve inserted for the moment, but it always go to the “IT” scope, nevermind what I choose:

image

Hi there @Airun

I did not fully understand your query. Are you always ending up with the same result ? Or is it that you want to know how the flow switch statement works?

Overall the flow looks fine - whatever you select from the dropdown from the form will be the decider for the switch and if you have created all the options then it should work fine. Also if there are going to be other options that will not be covered in your forms then keep a default flow switch too

Hi @Raghavendraprasad , thank you for your fast answer! :slight_smile:

I’m sorry I’m not very well in english. I want to know how the flow switch statement works, I don’t know how I must redige the expression to take into consideration the different possibilities from my drop-down list and go to each case depending on the option choosen on the drop-down list.

If I put my drop-down list output variable on the expression field, when I go to the case arrows, I can rename the arrow with my option, “ITGroup” for example, but it’s not really taking it into account I think (on the drop-down of the case I only have null and empty options and even if I wrtie there “ITGroup”, “OPEGroup” and “FINGroup” it don’t works, it always go trough the first one when I run it as if the filter is not working):

I’ve also tried this without any success:

I’m also testing the “SwitchCase” xaml that I’ve found on the post “What the Use Case for a Switch vs Flow Switch” but, if I change the variable type and the type of argument to string, the Switch don’t works, it always go to the default case even if the word inserted on value is the same as the word for a case:

image

I also see that on the “FlowSwitchName” published on the same post, they also use an expression that returns a numeric value.

Is this only possible to use the switch with numeric values? We can’t work with strings in a switch? :thinking:

Change the type argument of Switch to

String

it will work

@Airun If you have already made the Type Argument of Switch Activity to String Type, in the cases, you don’t need to pass Double Quotes in it to make it as a String, you can pass the value directly, as shown in the Screenshot below :

3 Likes

Main.xaml (9.8 KB)

Hi,
Please refer the attached xaml file for switch case flow. Verify the properties and let me know if it helps.

Thank you…

In case item write Lupa instead of “Lupa”

2 Likes

Thank you @supermanPunch!!! Without double cuotes it works with strings perfectly!! You always have the solution for everything!! :star_struck: :clap:

3 Likes

I’ve not tried it, I solved the issue just by writing the text without double cuotes as indicated by @supermanPunch but thank you very much anyway for the effort! :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.