Skip to content

Instantly share code, notes, and snippets.

@arufian
Last active August 29, 2015 14:06
Show Gist options
  • Save arufian/736d8044cea691a34b9e to your computer and use it in GitHub Desktop.
Save arufian/736d8044cea691a34b9e to your computer and use it in GitHub Desktop.
Assigning List of Salesforce Object Value into SelectOption
public class OptionController {
public List<CustomObject__c> ListOfItems {get;set;}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
for(CustomObject__c sObj: ListOfItems) {
options.add(new SelectOption(sObj.Id, sObj.Name));
}
return options;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment