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
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()
-
mind adding a documentation reference or explaining how this function works ? Nov 4, 2013 at 15:10
-
1
-
2Thanks, 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– DedoNov 4, 2013 at 15:35
-
How about using email templates ? then you don't need to worry about translations SForce does it for you– ManSpanNov 4, 2013 at 15:52