Query -
SELECT thepicklistfield__c, count(Id) records FROM Account GROUP BY thepicklistfield__c
The values which you do not see under thepicklistfield__c are not selected.
Use the below script to split -
Set<String> selectedValues = new Set<String>();
for (AggregateResult aggregate : [
SELECT thepicklistfield__c FROM Account GROUP BY thepicklistfield__c
]) selectedValues.add((String)aggregate.get('thepicklistfield__c'));
List<String> notUsedValues = new List<String>();
for (PicklistEntry entry : Account.thepicklistfield__c.getDescribe().getPicklistValues())
if (!selectedValues.contains(entry.getValue())
notUsedValues.add(entry.getValue());
system.debug(JSON.serialize(notUsedValues));
Comments
Post a Comment