You need to sign in to do that
Don't have an account?
Populate Product name in select list
How can I populate my select list with the product names? I know instead of creating new options:
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
I have to call the name field in the products object but i can't fiqure out how to do it. Anyone got any ideas?
-Hkp716
public with sharing class plist1 {
String[] prods = new String[]{};
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public String[] getprods() {
return prods;
}
public void setprods(String[] prods) {
this.prods = prods;
}
public List<Product2> getProducts() {
List<Product2> ProductsForPage = [Select Id,Name,Brand__c From Product2];
return ProductsForPage;
}
}
Try this:
Regards, jh
All Answers
Try this:
Regards, jh
Worked perfectly you're an SFDC god. Now i just need to create a button to transfer selected name to another list.
-hkp716