Leading Through Change with Data
COVID-19 Data Hub
COVID-19 Global Daily Tracker
Global Economy Data Track
Government Data Track
Healthcare Data Track
Leading Through Change
Leading Through Change Blog
< Back to List
Schema.DescribeFieldResult should provide method to get inactive picklist values
Schema.DescribeFieldResult class provides a method called getPicklistValues() which returns a list of active values in the picklist field. This class should also provide a method called getInactivePicklistValues() which will return a list of all the inactive values in this picklist as inactive picklist values can also be assigned to records of that object. So if we want to find out using Apex code which inactive picklist values are in use (are assigned in any record of that object), then we can do so using this new method if it is provided.
Existing code of getPicklistValues() method :-
// Account_classification__c is a picklist field on Account standard object
Schema.DescribeFieldResult fieldResult = Account.Account_classification__c.getDescribe();
// This will return the active picklist values only
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for(Schema.PicklistEntry pickListVal : ple)
System.debug(LoggingLevel.INFO, '#### picklist label is ' + pickListVal.getLabel());
System.debug(LoggingLevel.INFO, '#### picklist value is ' + pickListVal.getValue());
// Always only "true" will get printed for isActive checking
System.debug(LoggingLevel.INFO, '#### picklist isActive is ' + pickListVal.isActive());
- 22 days ago
- 4 months ago
- 4 months ago
Géraldine ANDERSON GOUBET
- 7 months ago
- 8 months ago
The Landmark © One Market St.,
San Francisco, CA 94105
If you can't find what you're looking for,
contact Salesforce Customer Support.
Powered by Community Cloud.
Learn More >
Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.
Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.
Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.
Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.