Skip to main content
vinod fnu (ttsd) ha preguntado en #Apex
i am trying to write a test class to cover a multipicklist field.

i am not able to pass the multiple value using apex.
5 respuestas
  1. 1 abr 2024, 15:04

    For anyone who needs to assign a Set or List of strings to a multiselect picklist you can use String.join(listOfString, ';')

    Example:

    List<String> listOfMultipicklistValues;

    // assign to a multipicklist field

    sObject.multiPickField__c = String.join(listOfMultipicklistValues, ';');

    // FYI: String.join() method will merge the elements in the list and separate them with the separator in the second parameter

0/9000