Salesforce Admins, convert Multi-Select Picklist fields into text – the easy way!

Kruvi Solutions is first and foremost here to help the Salesforce community. You may know that we spend countless hours mentoring, answering questions, and helping professionals pass their exams. But every now and again we try to do something special, and today we did!

We recently set out to help someone convert a very large multi-select picklist field into plain text. The requirement was to display the list of values in a related record, but there could be a host of other reasons to want such a thing. Normally, MSPs can be converted to text using formula fields, following the pattern:

IF (INCLUDES(MSP__c, "Value 1"), "Value 1, ", "") + 
IF (INCLUDES(MSP__c, "Value 2"), "Value 2, ", "") +
IF (INCLUDES(MSP__c, "Value 3"), "Value 3, ", "") ...

But once the options grow beyond a certain number, a formula solution becomes unfeasible. So we opted for another solution.

Introducing Multi-Picklist to Text

Our idea is to create a free package which contains actions that can be used in Process Builder and Flow – two of Salesforce’ powerful automation tools. This package contains an Apex action which can be used to convert any multi-select picklist value, and save it on a text field. You can also send the result into a flow output variable.

We named it Multi-Picklist to Text – or MPTT for short. You can install it by following this link – it’s completely free┬╣.

After installing the package, your org will have access to the Multi-Picklist to Text action in both the Process and Flow builders.

Convert Multi-Picklist to Text in Process Builder

The first method of using MPTT is in Process Builder. Use this method if you want a straight up approach of converting a Multi-Select Picklist field into a regular Text, Text Area, or Text Area (Long) field.

Create a Process and Criteria

Start by creating a process on your target object (or ideally, extend an existing one). Add a criteria step to check for your conditions. In this example we’ll check whether a record is created, or the multi-picklist field has changed:

You can use whichever criteria fits your requirement

Create an Action

Now add an action and select the Apex type. Under Apex Class, select Multi-Picklist to Text. You will see some fields to populate, but will also need to click Add Row (twice) in order to add the Save on: Record ID and Save on: Field API Name options.

The list of parameters is as follows:

  • Check Permissions controls whether or not object and field-level permissions will be checked before saving the record. Your user may not have access to the field you are trying to save the result into. In such an event, when you set this parameter to True, the record will not be updated.
  • Sort Values allows you to sort the selected picklist values alphabetically, instead of their order in the picklist.
  • Delimiter sets the separator between the values. You can use a comma, dash, slash, the word “and”, or whatever comes to mind. You will also probably want to add a space after your separator.
  • Picklist Value is a field reference to your picklist field. The value that you want to convert to text.
  • Save on: Record ID should be set to the ID value of the record where you want to save the result. This could be the ID field in the record that triggered the process, or an entirely different record if you wish.
  • Save on: Field API Name is the name (not the field reference) of the text field where the result should be saved.
For Save on: Field API Name, we wrote the API name of the text field

POOF: You’re finished! Remember to activate the process and try it out.

Convert Multi-Picklist to Text in a Flow

Converting a multi-picklist field to text can also be done in a flow using the same action. Let’s create a simple flow that queries a contact:

Can’t get much more simple than that!

We can now drag an Action component from the toolbox. In the popup screen, select Multi-Picklist to Text, and fill in the parameters. Here we used our Multi Picklist field from the queried Contact record, and separated each value with a comma followed by a space.

Note that the Save on: Field API Name and Save on: Record ID parameters are both checked off. While you certainly can fill these in if you want to, they are optional. You can use the result in screens, actions, or assignments later on in the flow without having to save it to a record.

We’ve decided to display our results in a screen:

And that’s all there is to it!

Parting Words

If you’re still reading, we hope your day has been made slightly better with this app. If you’ve experienced any problems with it, or have suggestions for other things people may be struggling with, we welcome your ideas.

┬╣ Kruvi Solutions does not take responsibility for issues or data loss that may arise with using this package. The package is provided as-is.