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.
You could do the following in a field update for
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
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.
We can populate this by :
IF ( INCLUDES ( parent.multipicklist__c , "Value 1" ), "Value 1; ",null ) &
IF ( INCLUDES ( parent.multipicklist__c , "Value 2" ), "Value 2; ",null ) &
IF ( INCLUDES ( parent.multipicklist__c , "Value 3" ), "Value 3; ",null ) &
IF ( INCLUDES ( parent.multipicklist__c , "Value 4" ), "Value 4; ",null ) &
IF ( INCLUDES ( parent.multipicklist__c , "Value 5" ), "Value 5; ",null )