toLabel() function in SOQL

  • toLabel() is used to convert the results of a field into user’s language.
  • toLabel() can convert the results into user’s language, if the translation workbench is enabled.
  • In all Salesforce edition we can use toLabel().
  • For picklist and Record type values we can use the toLabel() function in SOQL.

Here is an example:

SELECT Name, toLabel(Industry) FROM Account


download (1)

  • Ken Koellner

    What is also useful is that you can use a column alias and get both the regular value AND the label —

    SELECT Name, toLabel(Industry) IndustryLabel, Industry FROM Account