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
bensondanielbensondaniel 

Itereating through

Can anyone help me with itereating a Picklist (Multi-Select)?

I just want to use a for loop and make a list out of it.

sfdcfoxsfdcfox

Do you mean, the values stored in the list, or the values available in the list?

 

The former, you'll just need to call String.Split('; ') on the field's value, and iterate through the list.

The latter, you'll want to use SobjectField.getDescribe().getPicklistValues() and iterate through the the list of Schema.PicklistEntry objects.

 

Both of these topics are covered in the Apex Code documentation in the appropriate section.

Ankit AroraAnkit Arora

I hope you want to create a list of values selected in multiselect picklist.

If so then sfdcfox has already given you the answer that just split the selected value of multi select picklist using String.Split(';').

 

 

Thanks
Ankit Arora