Scenario:
- 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.
Solution:
- 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.
- IF(INCLUDES(Colors__c,'Red'),1,0)
+ IF(INCLUDES(Colors__c,'Green'),1,0)
+ IF(INCLUDES(Colors__c,'Blue'),1,0) - Click save. That is it.
Colors__c Field Multi-Select Picklist: (Red, Green, Blue)
No_of_Colors_Selected__c Formula Field:
Using the Field in the Object (Account in this case):<== As you can see I selected Red and Green Values from the Colors__c box.
Click Save to see if Formula Works:
No_of_Colors_Selected is 2 which is correct because I only selected Red;Green values from the Colors__c Picklist.
eTechCareers.com <== Coming Soon!!!! All of your Employment needs for Information Technology and Project Management.
LINKS:
Hey thanks but I'm facing a problem. Ihv 150 items and the formula gives an error "Formula tooo big" :(
ReplyDeleteThis is a great solution!! Thanks! Now, it has brought up one more issue. I used this formula for 2 different Multi-picklist fields. My client needs to see the two "multi-picklist fields in a grid format. I don't think it will be possible anymore since there are many fields (instead of the two that I had before). Do you have any ideas for this issue?
ReplyDeleteThanks!
Get new certificates that improves your knowledge. Getting certified in Cisco 300-410 Exam improves your professional advancement. Marks4sure.org offers real updated 300-410 Dumps and practice test.
ReplyDelete