Is it possible to automate the process of picklist values retrieval from the backend?
Here is how I am doing it right now:
@AuraEnabled
public static List<String> retrieveMyObjectMyFieldOptions() {
List<String> res = new List<String>();
Schema.DescribeFieldResult fieldResult
= MyObject__c.MyField__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for(Schema.PicklistEntry f: ple) {
res.add(f.getLabel());
res.add(f.getValue());
}
return res;
}
Is it possible to pass two strings to a method and get the same list as above? In other words is it possible to change the signature to the following:
public static retrieveMyObjectMyFieldOptions(String MyObject, String MyField)
?