I have a getter method to create a SelectOption. I want to put all the keys in Returned value to a List in another Method.
public List<SelectOption> getsortlist() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Parent.Profile.Name','Profile Name'));
options.add(new SelectOption('sObjectType','sObject'));
return options;
}
and retrieving the values here
List<SelectOption> opt = getsortlist();
List<String> theList = opt.getValue();
Error is
Method does not exist or incorrect signature: void getValue() from the
type List
How to solve this issue?
Best Answer
You can't do this in a list you need a loop to get all value then you can add them in a list.
getValue()
works for single variable not for a list.SelectOption GetValue