Blog

Handling Multi-Select Picklist Values Using Flows

Objective :

In this, we will handle multi-picklist values and split them based on the semicolon, and store
the values in the collection of strings using Flows.

Use Case :

Here, we took an example of creating an account record by entering the Account Name,
Phone, City, and Capital using screen flow. Here the City is of type Multi picklist and the
Capital is of type picklist.

The flow allows creating account records only when the Capital value is not selected in the
City values.

Step 1 :

Create a Screen Flow, we have created a flow ‘Account Flow with Multi Select Picklist’.
Added the Screen to get the input of Name, Phone, City, and Capital values from the User.

Step 2 :

In the Assignment element, assigned the selected City multi-picklist value to the new
variable.

Multi-select picklist values

Created four formula variables

VariableFormula
SeparateString(LEFT({!SelectedCity},FIND(“;”,{!SelectedCity
})-1))
LastSeparateStringTRIM((RIGHT({!SelectedCity},LEN({!Select
edCity})-FIND(“;”,{!SelectedCity}))))
RemoveAddedStringTRIM(SUBSTITUTE({!stringToRemove},
{!SeparateString}, “”))
SplitStringTRIM(
SUBSTITUTE(
{!Select_City},
“;”,””) )

Step 3 :

Added Assignment element, in that, added the each selected multi-select picklist value to the
Collection of list.

Removed the added value from the selected City (i.e) string variable which contains selected
multi-select picklist values.

Multi-select picklist values

Step 4 :

Added a decision to add all selected values are added to the list and to stop the
recursive call when the last selected value is added.

Multi-select picklist values
Multi-select picklist values

Step 5 :

Using the Collection filter element, get the selected capital value which is present in
the selected city multi-pick list value.

Multi-select picklist values

Step 6 :

Added the decision to check if the string collection which is returned from the
collection filter has value, it will not allow creating account record or else account record will
be created for the given values.

Multi-select picklist values
Multi-select picklist values
Multi-select picklist values

The Final Flow will be

Multi-select picklist values

Output

For the selected Capital value that does not contain in selected City value.

Multi-select picklist values
Multi-select picklist values

For the selected Capital value that does not contain in selected City value

Multi-select picklist values
Multi-select picklist values