Flow Multi-Select Picklist Selection Workaround

Recently, a colleague ran into the Flow Multi-Select Limitation where only the last option selected in a multi-select picklist input was being used later in the flow despite all the values being selected and being semi-colon space “; ” delimited. To work around this, a sub-flow was used to take in the semi-colon space delimited values, parse out the values, and output a text collection of the picklist values.

Summary Description

The above sub-flow does the following:

  1. Takes in a semi-colon space separated list of multi-select picklist values in a variable.
  2. If the variable has one or more values, fetch the next picklist value from the variable, add it to a text collection and remove it from the variable.
  3. If there are more values, repeat from step 2. Otherwise, stop and output the text collection.

Let’s take this step-by-step.

Create the mspValues Variable

First, create an mspValues Text, Input Only Variable so that the sub-flow can have the semi-colon space delimited values passed to it.

Next, let’s create the formula fields that will help parse out the values.

Create Next_Picklist_Value Formula

The Next_Picklist_Value formula parses out the next picklist value from the mspValues input, if there is one.

If (IsBlank({!mspValues}), null,
If (Contains({!mspValues}, ‘; ‘) == false, {!mspValues} ,
Left( {!mspValues} , Find(‘;’, {!mspValues} ) – 1)
))

This formula says

  1. If the mspValues is blank, return null.
  2. Otherwise if the mspValues doesn’t contain a semi-colon, return the variable because it only has one value left.
  3. Otherwise, there are multiple values so only return the first one by returning everything from the start of the variable up to, but excluding, the semi-colon.

Create Has More Picklist Values? Decision

Now, add a decision to the canvas and name it “Has More Picklist Values?”. The first editable outcome is “Has Picklist Value” and its criteria is “Next_Picklist_Values is Null $GlobalConstant.False”. Also, relabel the default outcome to “No More Picklist Values” so it’s more descriptive.

Please remember to occasionally save the flow so the work isn’t lost. At this point, our decision element determines if there are additional values or not so now we can add the picklist values to a text collection so let’s create the collection next.

Create the Picklist Values Collection

Now, let’s create the Picklist_Values_Collection so that the master flow that uses the sub-flow can use the parsed values.

Now that we have the text collection, let’s add the picklist values to it.

Create Add Picklist to Picklist Collection Assignment

Add an assignment to the canvas that adds the Next_Picklist_Value formula to the Picklist_Values_Collection text collection.

After the assignment is added, connect the “Has More Picklist Values?” decision to the assignment using the “Has Picklist Value” outcome. After the picklist value is added to the collection, it has to be removed from the mspValues variable so that it won’t be added again. Now we have to fetch the remaining values and update the mspValues variable with the remaining ones. We’ll do that by creating a new formula to calculate the remaining values and another assignment variable to update the mspValues variable with the remaining values.

Create Remaining_Picklist_Values Formula

If( contains( {!mspValues} , ‘;’) == false, null,
Right( {!mspValues} , Len( {!mspValues} ) – Find( ‘;’, {!mspValues} ) – 1))

This formula says

  1. If there’s no semi-colon in the mspValues variable, return null to signal there are no other values. Remember that even though the picklist has been added to the collection, it hasn’t been removed from the mspValues variable yet.
  2. Otherwise there is a semi-colon and there are more values so fetch the remaining values to the right of the semi-colon and space delimiter and return that.

With the Remaining_Picklist_Values formula created, now the second assignment can be created to update the mspValues variable to the remaining ones.

Create Remove First Picklist Value Assignment

Add a second assignment to the canvas and name it “Remove First Picklist Value”. Set the variable to “mspValues”, the operator to “equals”, and the value to “Remaining_Picklist_Values” formula.

Now, connect the “Add Picklist to Picklist Collection” assignment to the “Remove First Picklist Value” assignment.

Next, connect the “Remove First Picklist Value” assignment to the “Has More Picklist Values?” decision.

Save, Activate and use it in your other flows as needed. This is used immediately after your screen with the multi-select picklist input on it and it as the input to this sub-flow. The output of this sub-flow is the text collection to map to another text-collection that can then be used as needed.

For the coders reading this, we’re essentially creating a while loop in our flow that parses out the values from the semi-colon space “; ” separated list of mult-select picklist values passed into it and outputting the values in a text collection.

9 thoughts on “Flow Multi-Select Picklist Selection Workaround”

  1. This is awesome! I was about to hard-code some values in the flow and I came across your solution. Nice job and thanks for posting.
    Not sure if there was a change with a recent release but I had to change the syntax a little in order to get this to work.
    Changed the FIND quotation marks to double. And removed the -1 on the RIGHT formula.

    Next_Picklist_Value :
    IF( ISBLANK({!mspValues}), NULL,
    IF( CONTAINS({!mspValues}, ‘;’) == false,
    {!mspValues},
    LEFT({!mspValues}, FIND(“;”, {!mspValues})-1)
    ))

    Remaining_Picklist_Values :
    IF( ISBLANK({!mspValues}), NULL,
    IF( CONTAINS({!mspValues}, ‘;’) == false, NULL,
    RIGHT ({!mspValues}, LEN({!mspValues}) – FIND(“;”,{!mspValues}))
    ))

    1. This formula works, but with the changes of changing the curly quotes to straight ones. Thanks for your effort on this one.

  2. Hi!

    I’m getting a syntax error for both of the formulas.

    I’m copying the exact syntax as you have here (and also tried the ones Luke suggested above but with the same syntax error).

    Thanks in advance!

  3. Hello – I keep getting invalid syntax error while trying to save the flow. Any suggestions ?

    Next_Picklist_Value (Formula) – The formula expression is invalid: Syntax error

    Formula –
    Next_Picklist_Value :
    IF( ISBLANK({!mspValues}), NULL,
    IF( CONTAINS({!mspValues}, ‘;’) == false,
    {!mspValues},
    LEFT({!mspValues}, FIND(“;”, {!mspValues})-1)
    ))

  4. Did anybody figure this one out? I’m getting the syntax error too with no extra detail saying what the error is

  5. Looking at above fromula examples, if you copy these, you might run into a dumb issue.

    These quotes are curly quotes, not straight ones.

    Make sure to correct all quotes to be straight, and then it should work.

  6. These worked for me. Make sure you re-type the ” and ‘ so that they are straight and not curly (they look damn near the same– look closely):

    Next_Picklist_Value:
    IF( ISBLANK({!mspValues}), NULL,
    IF( CONTAINS({!mspValues}, “;”) == false,
    {!mspValues},
    LEFT({!mspValues}, FIND(“;”, {!mspValues})-1)
    ))

    Remaining_Picklist_Value:
    IF( ISBLANK({!mspValues}), NULL,
    IF( CONTAINS({!mspValues}, “;”) == false,
    {!mspValues},
    RIGHT({!mspValues}, LEN({!mspValues})-FIND(“;”, {!mspValues})-1)
    ))

  7. Hi All,

    This is my multipicklist values
    123=>Apple, 456=>Banana, 789=>Orange

    I am getting Picklist Label instead of key when I am using this formula.

    Eg: mspValues -> 123; 456

    Next_Picklist_Value = ‘Apple’
    Remaining_Picklist_Value = ‘Banana’

    Any idea why I am getting like this?

    Thanks in advance!

Comments are closed.