Translate SOQL Query Results
To translate SOQL query results into the language of the user who submits the query, use the toLabel method. If no translation is available, the method returns the search results in the default language of the organization.
Any organization can use the toLabel() method. It’s useful for organizations that enabled the data translation. For information on how to enable data translation, see Manage Entities’ Data Translation in Salesforce Scheduler Help.
The toLabel method uses the following syntax:
This method is supported on the WorkTypeGroup, ServiceResource, and ServiceTerritory objects. Use this method to return translated search results on the following fields:
- Name
- Description
- Custom fields of type Text, MultiLine Text, Long Text Area, Rich Text Area, and URL
You can’t use the toLabel() method in the ORDER BY clause. For limitations that apply to the translation, see Translate Returned SOQL Results in SOQL and SOSL Reference.
Example of data translation request for WorkTypeGroup:
Where YOUR_INSTANCE is a variable.
Example of data translation request for ServiceResource:
Where YOUR_INSTANCE is a variable.
Example of data translation request for ServiceTerritory:
Where YOUR_INSTANCE is a variable.
Example of translated query results for WorkTypeGroup:
Example of translated query results for ServiceResource:
Example of translated query results for ServiceTerritory: