I am completely new to salesforce currently trying to learn some basic stuff with Apex and Visualforce pages. I have a custom Object with a multi-select Picklist and i'm trying to update this field using a VF page.

This is my current controller to get the available options on the field.

public List<SelectOption> getTecnoUsada(){
    List<SelectOption> optionList = new List<SelectOption>();
    Schema.DescribeFieldResult fieldResult = ExpedienteEstudiante__c.Tecnologia_usada__c.getDescribe();
    List<Schema.PicklistEntry> lista = fieldResult.getPicklistValues();
    for( Schema.PicklistEntry f : lista)
        optionList.add(new SelectOption(f.getLabel(), f.getValue()));
    return optionList;

This is the VF code to display the checkboxes

<apex:selectCheckboxes id="tecnoUso" value="{!tecnologia}" style="width: 100%; height: 100%;" layout="pageDirection">
                                        <apex:selectOptions value="{!TecnoUsada}" />

The thing is that everytime I try to "save" the data the page freezes and it does nothing.

  • 1
    Where is your Save?
    – EricSSH
    Commented Apr 17, 2017 at 22:07

1 Answer 1


Declare a getter setter value in your controller. This will hold the multi select picklist values.

 public List<String> tecnologia{get;set;}

also intialize this in the constructor-

tecnologia = new List<String>();

Salesforce accepts semicolon separated values as multi select picklist values. Now to convert this list to that format use the following code block in your save method -

        String pickListVal = '';  // variable to store the multi select data in semicolon separated way
        for(String a : tecnologia)
            pickListVal += a+';';
            pickListVal= pickListVal.substring(0,pickListVal.length()-1);  // removes the last semicolon
        ExpedienteEstudiante__c obj = new ExpedienteEstudiante__c();
        obj.Id =  CustomObject.Id; // Id of the record for which this multi select value has to be set
        obj.Tecnologia_usada__c = pickListVal; 
        update obj;
        pagereference pr = new pagereference('/' + obj.id);
        return pr;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .