toLabel()

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

         toLabel(object.field)

For example:

         FIND {Joe} RETURNING Lead(company, toLabel(Recordtype.Name))

This query returns lead records with the record type name translated into the language for the user who issued the query.

Note
You cannot filter on the translated name value from a record type. Always filter on the master value or the ID of the object for record types.

You can use toLabel() to filter records using a translated picklist value. For example:

         FIND {test} RETURNING Lead(company, toLabel(Status) WHERE toLabel(Status) = 'le Draft' )      

Lead records are returned where the picklist value for Status is 'le Draft.' The comparison is made against the value for the user’s language. If no translation is available for the user’s language for the specified picklist, the comparison is made against the master values.

Note
The toLabel() method cannot be used with the ORDER BY clause. Salesforce always uses the order defined in the picklist, just like reports.
© Copyright 2000-2008 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.