function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kon DeleKon Dele 

How to dynamically select all multi-select picklist values based on checkbox

I have a class and trigger that copies selected values but is there a way to dynamically select all values in a multi-select picklist when an All Offices checkbox is checked?
User-added image
Here's my code:
public class OfficeUpdateClass {
    public static void UpdateOffices (ContentVersion[] ContentVersion1){
        for(ContentVersion cv: ContentVersion1){        
            String pickValuesStr;
                List<String> pickValues = cv.Office__c.split(';');
                for(String str : pickValues){
                        pickValuesStr = str;
                        pickValuesStr = pickValuesStr + '\n' + str;
            cv.Content_Offices__c = pickValuesStr;  
and the trigger:
trigger OfficeUpdateTrigger on ContentVersion (before insert, before update) {
    ContentVersion[] ContentVersion1 =;

Hi Kon,

YOu can see my post here.