Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PickListController {
- @AuraEnabled
- public static List<String> getPickListValuesIntoList(String objectType, String selectedField){
- List<String> pickListValuesList = new List<String>();
- Schema.SObjectType convertToObj = Schema.getGlobalDescribe().get(objectType);
- Schema.DescribeSObjectResult res = convertToObj.getDescribe();
- Schema.DescribeFieldResult fieldResult = res.fields.getMap().get(selectedField).getDescribe();
- List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
- for( Schema.PicklistEntry pickListVal : ple){
- pickListValuesList.add(pickListVal.getLabel());
- }
- return pickListValuesList;
- }
- }
Add Comment
Please, Sign In to add comment