function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Salesforce_NikitaSalesforce_Nikita 

Characters from different language

How can we match characters from different language in SOQL Query clause?

Ashish_SFDCAshish_SFDC

Hi Nikita,

 

You will have to use the toLabel()


A client application can have results from a query returned that are translated into the user’s language, using toLabel():
toLabel(object.field)
Use toLabel() on regular, multi-select, division, or currency code picklist fields (any field that has picklist values returned
by the relevant describe call), data category group and data category unique name fields or RecordType names. Any organization
can use toLabel(). It is particularly useful for organizations that have the Translation Workbench enabled.
For example:
SELECT Company, toLabel(Recordtype.Name) FROM Lead
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:
SELECT Company, toLabel(Status)
FROM Lead
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 ORDER BY. Salesforce always uses the picklist’s defined order,
just like reports. Also, you can’t use toLabel() in the WHERE clause for division or currency ISO code picklists.

 

pg 6 http://www.salesforce.com/us/developer/docs/soql_sosl/salesforce_soql_sosl.pdf

 

Also see the beklow link for further info, 

 

http://salesforce.stackexchange.com/questions/8565/can-i-query-the-translated-value-and-return-the-key-in-translation-workbench

 

Regards,

Ashish

 

Salesforce_NikitaSalesforce_Nikita

 think this is possible only for Record Type Name and picklist. What for Normal text field or lookups?

Ashish_SFDCAshish_SFDC