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.
Created four formula variables
Variable | Formula |
SeparateString | (LEFT({!SelectedCity},FIND(“;”,{!SelectedCity })-1)) |
LastSeparateString | TRIM((RIGHT({!SelectedCity},LEN({!Select edCity})-FIND(“;”,{!SelectedCity})))) |
RemoveAddedString | TRIM(SUBSTITUTE({!stringToRemove}, {!SeparateString}, “”)) |
SplitString | TRIM( 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.
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.
Step 5 :
Using the Collection filter element, get the selected capital value which is present in
the selected city multi-pick list value.
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.
The Final Flow will be
Output
For the selected Capital value that does not contain in selected City value.
For the selected Capital value that does not contain in selected City value