Multiselect Magic: Manage Multiselect Picklists with Flow

Flow has never been good at managing multiselect picklist fields. Over the years, many intrepid flowhanites have provided assistance. Here, we provide an installable Flow Action that leverages last year’s new support for generic types to provide a nice and simple new way to solve problems that use these fields.

Use this new Manage Multiselect Field action to easily do these things:

  1. Select an additional value for a multiselect picklist field
  2. Deselect a selected value from a multiselect picklist field
  3. Check for the presence of a particular value in the set of selected values
  4. Given a specific record, obtain both the full set of available values and the currently selected values in the form of a List of Strings that can be used downstream in your flow with tools like QuickChoice.

Inputs

objectApiNameStringName of the object where your field is
fieldApiNameStringName of the multiselect picklist field you’re manipulating
operationStringSupported values are CheckForValue, ReturnStringCollection, AddValue, and RemoveValue
targetValueStringUse to specify a value to add or remove, or to check for whether a value is selected.
saveAutomaticallyBooleanIf set to true, will save any changes made by the action immediately. Note that this will commit any open transactions in the flow
curRecordRecordthe actual record you’re examining or changing

Outputs

availableValuesListList<String>
selectedValuesListList<String>
selectedValuesSemicolonStringString (this is the ‘native’ way that these fields store data)
targetPresentBoolean Returns a value if action is set to

Install

VersionUnmanaged 5/16/21

Installation note: This package currently creates a multiselect picklist field called ‘Fruit__c’ on the Account object to provide something to run tests on. If that’s a problem, you can install this action without the test class by simply grabbing the main action code here and pasting it into a New Class in Developer Console.

Source

source