Flows | Parse Multi Select Picklist Values in a Flow with an Apex Action

In this post we will see how to Parse the Multi-Select Picklist Values in a Flow. Parsing the Multi-Select Picklist Selected values in a Flow is required where we need to use Selected Multi Select Picklist values later inside the Flow for Loop and various use cases like as a Collection variable to Loop on them. We will Assign the Multi Select Picklist Values to a Collection Variable. We will also see Salesforce Flow Loop through Multi Select Picklist in this article. Best part is that you just need to download an Apex Action to use this Feature .

Access the Multi Select Picklist Values Individually in the Flows

Salesforce Flow Multi Select Picklist Parsing can be required on Screen Flows where we need to know and use values selected by user from a Multi Select Picklist on a Flow Screen and also on Auto Launched or Record Triggered Flows where we need to use the existing values of a Multi-Select Picklist of a record within the Flow. We basically need to have a Salesforce Flow Multi Select Picklist Collection Variable so that it can be used as a Flow Loop Variable to Loop on Multi Select Picklist Field values.

Why we need to Parse Multi Select Picklist Values in Flow?

Well, we need it because whenever we use a Multi Select Field on a Flow Screen or query a Multi select field value of any record using a Get Element, the format of the Multi Select values is like this [A;B;C;D] which are semi-colon separated and not comma separated. This kind of variable is not considered as a Flow Collection Variable and cannot be used as a Flow Loop Variable. We somehow need to convert the Format of these values to [A,B,C,D] similar to a Text collection variable so that it can be used in Loops to Loop on Multi Select Values in a Flow.

How to Parse Multi Select Picklist Values in a Flow?

There are many solutions that I found on Google for a workaround of the problem I mentioned earlier about the Multi Select Picklist Value output format. 
But they all require either a Big Formula or lot of Flow Elements and overall the Flow becomes quite complex.

I have created a very simple Apex Action which can be easily downloaded and used in Flow to get the desired result and it creates a Text Collection Variable of the Multi Select Picklist Values. This collection variable can then be used to Loop or to perform any kind of operation / logic later for the selected or existing Multi Select Field values.

Note : We will see how to use this Apex Action in Screen Flows or any other type of Flow.

Download the Un-Managed Package from Links Below

Note : In case Package throws issues while Installation, below is the basic code that can be copy pasted in the org and can be used instead of the package.

Apex Class

global class MultiSelectFlowValues {



   public static List<list<string>> CheckValues(List<string> values) {



          string tempStr = values[0];

          List<String> lstnew = tempStr.split(';');

          list<list<string>> finalLst = new list<list<string>>();


          return finalLst;


      else return null;



Test Class


public class MultiSelectFlowValuesTestClass{



    static void MultiSelectFlowValuesTest(){


        List<string> tempLst = new list<string>();






Steps to Use this Package/Component :

1. Install the Package (for all Users) from link above (This step not needed if you copy the code instead)
2. On the Flow Canvas, Go to Action Element and Drag it on the Flow Canvas.
3. Search for Multi Select Flow from Search Box in the Action Element.
4. Select the option MultiSelectFlowValues which is the name of the Apex Class. Once Package is downloaded this will be visible otherwise you wont see this option.
5. Provide a name of the Element. 
6. Click on the Toggle Bar to include Input Values in the Action Element Screen.
7. In the Input value box just pass the variable which has Multi Select Picklist Values and need to be converted into a collection variable. This value can be passed from the Screen Multi Select Picklist component or from a Record Field or any other variable that has stored multi select picklist value.
8. That's it. 

Important : Now this Flow action Element will behave like a Text Collection Variable and can be used anywhere inside the Flow. The name of this collection variable will be the name/label of the Action Element that you provided in step 5 above. Checkout how that works in this article later.

Learn Salesforce Flows
Become Flow Champion - Click & Start Learning

How will this work and what will it do?

This is a very simple, basically to this action just pass any variable which contains Multi Select Picklist values either from a Screen Input or a Record Field. Once you do it, the Action Element will itself behave as a Collection Variable and can be used anywhere.

Note : The same Package can be used to Loop on CheckBox Group Values in a Flow. Check that out here https://www.accidentalcodersf.com/2021/01/loop-on-checkbox-group-values-in-flow.html

Assign Multi Select PickList Values to a Collection Variable in Flow

Basically it will take Multi Select Picklist values in format like this [A;B;C;D] and will return a text collection variable which actually looks like this [A,B,C,D].

Let's See this in action through a quick Example on a Screen Flow MultiSelect Picklist Component.

Multi Select Picklist Component on Screen Flow or Flow Screen

Let's say we have a simple Screen and it has Multi Select Pick List Input component added to that Screen and it displays a Case Field of type Picklist(Multi Select).

The name of this Multi Picklist component on Screen is say Case MultiSelect (Api Name : Case_MultiSelect). So, now whenever users will use this screen to populate this field the value of the Multi Select input will be automatically stored in this screen component named Case_MultiSelect.

So now if you need to use this variable later in the Flow just pass this variable name into the Input box in our Action Component as mentioned in the Steps. And it will in turn return you the values in Text Variable Format which can be used for any use later on in the Flow like using for Loop and all.

See Pics Below for better Clarity.

1. Add Multi Select Picklist on a Flow Screen and add a Multi Select Picklist Choice Set. I have added a Multi Select picklist choice set of case object and a multi-select field named Case Type.

The name is Important for this Component as all the user selected values are stored in this variable with the same name.
Flow Multi Select Picklist Parse
Added a Multi Select Picklist Component
As you can see the values for this Multi Select Picklist will be stored in the Variable named Case_MultiSelect.

2. Action Element - Now if you want to use the values of this variable as a Collection Variable to Loop over, we just need to Pass this variable in the Action Element as per steps mentioned above in article.

Add the Action Element and search and choose the option MultiSelectFlowValues as per steps shown earlier.
Salesforce Flow Multi Select Picklist Values
Choose the Apex Action with name MultiSelectFlowValues

3. Enter Name of the Action which will later behave as a Text Collection Variable. In our case I have named it as  Case_Multi_Select as per image below.

Multi Select Picklist Values in Flow Salesforce
Add the Name of Action which will behave as a Text Collection Variable

4. Enter the Input Values and Pass the variable which contains the Multi Select Pick List Values. In our case, the Multi Select Pick List values are stored in Screen Component named Case_MultiSelect which we created in Step 1 here. Just select and pass that to Action as per Images below.

So after saving this, Action Element box looks like this as shown below

5. Text Collection Variable : Now automatically this Action Element will behave as a Text Collection Variable which can be used for any kind of operation which can be done on a collection variable inside a Flow like using it in a Loop.

In our case the collection variable name was Case_Multi_Select from last step which can now be used as a Text Collection Variable.

Salesforce Flow - Multi Select Pick List Loop

Let's see an example how can I use it to run a Loop on this Text Collection Variable (Case_Multi_Select). I will simply select this collection variable to Loop over the Pick List Values selected on screen.

Example Video : Here's a Quick Video showing the Apex Action's usage when you need to pass and use a Multi Select Field values from a Record from Salesforce. In this video I am fetching a Case Record and then passing the value of a Multi Select Picklist into my action and in return I get a Collection Variable that can be used for Loops etc.

Important : I have just shown how this component will work with  Screen Multi Select Picklist values.
But similarly, it will work for any Multi select picklist values from any object or record's field on any type of Flow

For example in Record Triggered Flow on Case, I will pass $Record.Case_Type__c into my Action Element to get a Collection Variable of the stored values.

Hope this Helps! Reach out to me here or on LinkedIn for any questions, issues or suggestions. Happy to Help!

Learn Flows : Want to Learn Flows from Experts? Complete a Guided Course. Checkout my Personal Favourites below and Invest in Learning 

Best Salesforce Flow Courses Online
Learn Flows from Experts - Click Images to Checkout Courses

Best Salesforce Flow Courses Online


All Flow Examples and Tutorials on this Blog : All Flow Examples


  1. I'm curious about the test class. It calls the MultiselectFlowValues class, but doesn't do anything with the return. Shouldn't it compare the return to a known quantity ("AccidentalCoder,Salesforce") to ensure the class is returning what is expected?

    1. Hi Vince, you are absolutely right.
      You can enhance that test class but I just wrote a basic one just to get the coverage.

  2. this is super awesomeeeeeeeeeeeeeeee
    OMG !!!!!

  3. Hi Vibhor, this is really helpful, thank you so much!
    I'm still running into an issue and hope you can help me: We have two custom objects where we have a Multi-select picklist field with a country list. Let's say Object A and Object B where object B holds a list of "allowed" countries.

    In the end, all countries in the field in Object A need to be removed from the Picklist, that are not in Object's B allowed countries. The list in Object B is not fix, so I need a cleaning flow that is triggered manually (with a link or button) (and it sets a date that from now on, countries of object A need to be checked against allowed list)
    I'm using a flow for that purpose.

    In fact, I have two flows. There is one flow triggered from object A if there are changes in the Multi-select Picklist field, that checks, if all countries are allowed. It compares the two lists with loops and your apex snippet and it is working fine!

    But then I have another flow triggered from Object B. It finds all relevant object A records and updates them. And there I get an error message:
    "Error Occurred: The number of results does not match the number of interviews that were executed in a single bulk execution request."
    This error occurs at the first element in the flow, where I am creating a list of countries from the picklist. Do you have an idea what that means? And how to avoid it?

    The strangest thing is: even if I get those error messages, the functionality is working fine.

    Any idea?


    1. Could it be a problem, that I am trying to update several records B at once? Or should that work?

    2. Sorry not able to understand the issue and also I haven't encountered this error before so cant suggest anything right now :(:( ..Need to maybe see the flow screenshot to understand better. You can message me on linkedIn or mail me at vibhor.3k@gmail.com

    3. Hi Vibhor,

      thank you for your reply.
      Sorry, I think my explanation was not that easy to follow...:( in the end I could figure out that I always got an error when I did bulk updates that triggered this method for several records at once.

      I also asked in salesforce community and got help :)

      When I applied the changes to your class that Keiji suggested in the post linked above, it worked. I don't get the error message any more if I try to update records in bulk!

      Happy to share the solution with you and anyone interested :)

      Best wishes,

      This is the version he suggested and that worked for me:

      global class MultiSelectFlowValues {

      public static List> CheckValues(List values) {
      List> finalLst = new list>();
      for (String tStr : values) {
      List lstnew = tStr.split(';');
      return finalLst;
      else return null;

    4. Thanks a lot Henriette. This is a very good find and thanks for providing the solution for bulk records. For sure it will help many of us in future for this scenario


Post a comment

Thanks for your Feedback!


Salesforce Flow Examples : Flow Use Cases and Scenarios

Salesforce Spring '21 Release Preview | Latest Flow Features

Spring '21 Flows | Is Changed in Record Triggered Flows using Prior Value

Never Miss Latest Posts