Another Salesforce blog!!!

Salesforce, Apex

creating dropdownlist from custom field in apex


LINK

LINK2

List<Payment_Response__c> payResponseList = [select Payee_Country__c from Payment_Response__c] ;
List<SelectOption> optionList = new List<SelectOption>();
optionList.add(new SelectOption( ' ' ,'---Select---'));
Set<SelectOption> setCountry = new Set<SelectOption>();
for(Payment_Response__c r : payResponseList )
{
    setCountry.add(new SelectOption(r.Payee_Country__c, r.Payee_Country__c));  
    //ProductCatalogList1.add(new SelectOption(pc.Category__c,pc.Category__c)); 
    //optionList.add(new SelectOption(u.Id , u.Name));
}
optionList.addAll(setCountry);
 
system.debug('..'+optionList.size());

Leave a Reply

Your email address will not be published.

*