I am using SOQL to query the opportunity. When I use the query,


I am getting the values under the API Name of the picklist items. How to get the value from the Values of the picklist? enter image description here

  • Can you give any example exactly what you want? Mar 2 '17 at 12:09
  • I don't think so you can do that using SOQL query. Instead you can do that using Apex
    – RCS
    Mar 2 '17 at 12:24
  • What are these Action, Values and API Name columns?
    – Saroj Bera
    Mar 2 '17 at 12:29

You can use toLabel() to convert the picklist api name to a label:


  • That's awesome. This is what exactly I wanted. Mar 2 '17 at 18:14

You don't need to use SOQL to do this, instead you can get it using Apex's Schema utility and DescribeFieldResult class. For example:

public List<String> myPicklist {
  get {
    if (myPicklist == null) {

      myPicklist = new List<String>();
      Schema.DescribeFieldResult field = Object__c.MyPicklist__c.getDescribe();

      for (Schema.PicklistEntry f : field.getPicklistValues())


    return myPicklist;          

This just returns a List<String> of labels of the field MyPicklist__c in object Object__c.

You might want to review what you can do with that class here.

Bonus: you don't use any SOQL and contribute to limits.

  • 4
    This is useful for getting ALL of the possible picklist values for a field, but his specific question is about getting the label for a particular picklist value back from SOQL instead of the api name. Mar 2 '17 at 12:58
  • @JohnTowers That's true and your response definitely answers the question directly, but it's a bit of an XY problem. Yes you can use SOQL to get Picklist values, but that doesn't mean that you should. It's nice to put both answers on the table though. :) +1!
    – Dan Jones
    Mar 2 '17 at 13:00
  • 4
    These are two different use cases, though. If I want a list of all possible values for the field, your answer is the correct answer. But this question is about querying a record and returning the picklist value's label instead of it's API name. As of Spring '17, when you select a picklist field from a record the picklist value's API name is returned. You have to use toLabel() to retrieve the picklist value's label instead of it's API name in your results. Mar 2 '17 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.