8

I have am email body I'm generating in APEX and I want it to include the translated value of a picklist. How can I get the translated value in APEX?

1 Answer 1

10

You can use a SOQL function toLabel() to get translated picklist values:

SELECT toLabel(your_field__c) FROM YourObject__c 

Here is the official documentation:

A client application can have results from a query returned that are translated into the user’s language, using toLabel()

4
  • mind adding a documentation reference or explaining how this function works ? Nov 4, 2013 at 15:10
  • 1
    thanx @mast0r for adding the documentation link and for the edit :)
    – ManSpan
    Nov 4, 2013 at 15:18
  • 2
    Thanks, but this is not ideal for me, I have the records already (getting them from the trigger). I prefer not to query again. I hoped there is something like 'getTranslatedValue()' or something like quering the translated values themselves
    – Dedo
    Nov 4, 2013 at 15:35
  • How about using email templates ? then you don't need to worry about translations SForce does it for you
    – ManSpan
    Nov 4, 2013 at 15:52

You must log in to answer this question.

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