• Niko2
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi - I am trying to get the color value associated with a PicklistEntry. I've written some logic that gets the PicklistEntry, but I am not sure if there is a way to get the color associated with that entry using the Apex field describe methods. Can someone help me out or confirm that this isn't possible? (It looks like it is part of the metadata API, but I can't find any documentation on using it in Apex.)

 

 

Map<String, Schema.SObjectType> globalDescribe = Schema.getGlobalDescribe();
Map<String, Schema.SObjectField> objectFields = globalDescribe.get('Campaign').fields.getMap();
Schema.DescribeFieldResult fieldInfo = objectFields.get('Type');

if(fieldInfo.getType() == 'Picklist' || fieldInfo.getType() == 'MultiPicklist') {
for(Schema.PicklistEntry pe : fieldInfo.getPicklistValues()) {
// Instead of getValue(), is there a getColor() method? pe.getValue();
}
}