You need to sign in to do that
Don't have an account?

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?

Here's my code:
Here's my code:
public class OfficeUpdateClass { public static void UpdateOffices (ContentVersion[] ContentVersion1){ for(ContentVersion cv: ContentVersion1){ String pickValuesStr; if(!String.isBlank(cv.Office__c)){ List<String> pickValues = cv.Office__c.split(';'); for(String str : pickValues){ if(String.isBlank(pickValuesStr)){ pickValuesStr = str; }else{ pickValuesStr = pickValuesStr + '\n' + str; } } } cv.Content_Offices__c = pickValuesStr; } }and the trigger:
trigger OfficeUpdateTrigger on ContentVersion (before insert, before update) { ContentVersion[] ContentVersion1 = Trigger.new; OfficeUpdateClass.UpdateOffices(ContentVersion1); }
YOu can see my post here.
http://amulhai.blogspot.in/2013/05/multiselect-dependent-picklist-in.html