toLabel(fields)
Use toLabel(fields) to translate SOSL query results into the user’s
language.
Any organization can use the toLabel() method. It’s particularly useful for organizations that enabled the Translation Workbench.
1toLabel(object.field)For example:
1FIND {Joe} RETURNING Lead(company, toLabel(Recordtype.Name))The returned records are translated into the language of the user who issued the query.
You can use the toLabel() method to filter records using a translated picklist value. For example:
1FIND {test} RETURNING Lead(company, toLabel(Status) WHERE toLabel(Status) = 'le Draft' )The query returns lead records with a picklist value for Status equal to 'le Draft.' The comparison is made against the value for the user’s language. If no translation is available for the picklist, the comparison is made against the master values.
The toLabel function supports aliasing. In addition,
aliasing is required when the query includes the same field multiple times. For
example:
1FIND {Joe} RETURNING Lead(company, toLabel(Recordtype.Name) AliasName)