Skip to content

Instantly share code, notes, and snippets.

@lukethacoder
Created January 7, 2021 23:27
Show Gist options
  • Save lukethacoder/0550587d5f5d14a8620f5c3a014bc072 to your computer and use it in GitHub Desktop.
Save lukethacoder/0550587d5f5d14a8620f5c3a014bc072 to your computer and use it in GitHub Desktop.
APEX: Get a list of picklist values (PicklistEntry) objects in Apex Salesforce
List<PicklistEntry> fields = Account.SObjectType.getDescribe().fields.getMap().get('Type').getDescribe().getPicklistValues();
for (PicklistEntry picklistEntry : fields) {
System.debug(picklistEntry.getLabel() + ' with value: ' + picklistEntry.getValue());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment