Last active
June 18, 2018 14:48
-
-
Save Naveendhanaraj/2ade3b25b49912219c58c7b6b4a1f54b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment