- Need to capture the count of selected items in a multi-select picklist into a field.
- Note: This will work once the user clicks save on the record.
- Create a formula field in the salesforce object where the multi-select picklist resides.
- Make it a Number attribute with decimal holding of Zero
- Give it a name
- Click on Advance Formula
- Two conditions we will use is
- INCLUDES(multiselect_picklist_field, text_literal) method
- IF(logical_test, value_if_true, value_if_false) method
- Let say our Multi-Select Picklist was named "Colors__c" and the values were "Red", "Green", "Blue"
- We need to count the values that the user selected within this "Colors__c" Picklist.
- Formula would be as follows:
- Taking the INCLUDES(multiselect_picklist_field, text_literal) method first:
- INCLUDES(Colors__c,'Red') <== Basically means that when the user has selected "Red" from the multi-select picklist box named "Colors__c"
- Now place in IF Then Method:
- IF(INCLUDES(Colors__c,'Red'),1,0) <== If(the user chooses "Red" then give the value of the field a 1 otherwise a zero.
- Now we need to add to it so that it increments when a user selects more then 1 value from the multi-select picklist.
- Click save. That is it.
Colors__c Field Multi-Select Picklist: (Red, Green, Blue)