TransWikia.com

Populate a field with values that were selected in a multi-select picklist

Salesforce Asked by pmehra on December 31, 2021

Our org has a multi select pick list that we use to select different business . after the business have been selected, we write down a comment for each business selected. User have been complaining that its to tedious to retype in each business name and then write a comment. I am looking for ideas where I can auto populate the comment field with all the values that were selected in a picklist. I came across someone mention triggers but thats something I have no knowledge of.

2 Answers

You can create a custom metadata which will hold the mapping of Business Name to Comment for each one of them, this will be easily maintained by Admins in the Org. One to One mapping of Bussiness Name to Comment

The trigger on the Object you are working on can then query this metadata and get all the comments for the Business Name entered in the object, then get the comments for selected Business Name in custom metadata and update the Comment field with all comments.

Next time you make changes to Custom Metadata you code will dynamically pickup those changes without retouching the code.

Answered by Gourav Bhardwaj on December 31, 2021

You could do the following in a field update for Comment__c

value would be set to
             IF(INCLUDES(MSP__c,'BusinessA'),'Business A: <your notes here>',NULL) &
             IF(INCLUDES(MSP__c,'BusinessB'),'Business B: <your notes here>',NULL) &
             ...
             IF(INCLUDES(MSP__c,'BusinessZ'),'Business Z: <your notes here>',NULL)

where the result would be a text field that would look like (say Business C and Business E were chosen by user):

Business C: <your notes here> Business E: <your notes here>

and user could move the cursor to add in comments after each relevant business.

The above will break down if you have many MSP values as the formula will get too large - in that case, a trigger will be the best bet

Answered by cropredy on December 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP