Guest User

Untitled

a guest
Jun 19th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public class PickListController {
  2. @AuraEnabled
  3. public static List<String> getPickListValuesIntoList(String objectType, String selectedField){
  4. List<String> pickListValuesList = new List<String>();
  5. Schema.SObjectType convertToObj = Schema.getGlobalDescribe().get(objectType);
  6. Schema.DescribeSObjectResult res = convertToObj.getDescribe();
  7. Schema.DescribeFieldResult fieldResult = res.fields.getMap().get(selectedField).getDescribe();
  8. List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
  9. for( Schema.PicklistEntry pickListVal : ple){
  10. pickListValuesList.add(pickListVal.getLabel());
  11. }
  12. return pickListValuesList;
  13. }
  14. }
Add Comment
Please, Sign In to add comment