I would like to get label of stored picklist value. Is there any straight forward way of doing that or I have to loop through all picklist values?

  • I suspect you will have to loop through to get it. Might be an idea to store the label on a hidden field to save yourself repeated processing. Nov 16, 2012 at 4:11

2 Answers 2


For picklist values you can use the toLabel() function in soql to retreive the label, e.g.

select select id,name, toLabel(Industry) from account

Otherwise you can call describeSobject and get the label from the returned picklistValue structure.


You may Use Custom settings to store the Labels if you think looping may bring issues.Have a custom Setting with api name and label and you may use custom setting methods to retrieve only for those you want.

Map mapCodes = ISO_Country__c.getAll();
// display the ISO code for Afghanistan
System.debug(‘ISO Code: ‘+mapCodes.get(‘AFGHANISTAN’).ISO_Code__c);
  • The "custom setting approach" screw you up so hard as soon as a requirement to get the translated labels will pop up ;) Cust. Labels would be better...
    – eyescream
    Nov 16, 2012 at 7:07
  • Ah great point !!Yes if multilingual custom labels are preferred Nov 16, 2012 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .