In a single record, a user selects multiple values from a multi-select picklist. How are the selected values represented in Apex?
-
1Anzar, you know you could have simply created a multi-select picklist field in your org, populated it, and then queried for it using the Developer Console to figure this out– cropredyDec 28, 2015 at 21:52
-
1Yep @cropredy. I tried that out and found the selected multiple values are separated by semicolons. "Value1;Value2:Value3"– MnZDec 16, 2016 at 4:16
1 Answer
A string with the selected values separated by a semicolon:
Account fruitVendor = [SELECT Fruits_Sold__c FROM Account WHERE Name = 'I Sell Fruits'];
System.debug(fruitVendor.Fruits_Sold__c);
15:11:33:027 USER_DEBUG [2]|DEBUG|Apple;Banana;Orange;Grape