Instead of directly querying for the Value in the DataRaptor, a SOQL query can be used with the toLabel() function in an Apex Class Method, and this method can be called as a Remote Action from the OS, VIP or the DataRaptor. Using toLabel() method returns the translated values of the field according to current logged in user.
Sample Code for Remote Class:
global with sharing class SampleRemoteClass implements PACKAGE_NAMESPACE.VlocityOpenInterface2 {
global Object invokeMethod(String methodName, Map<String,Object> input, Map<String,Object> output, Map<String,Object> options) {
// Route to the correct method based on method name
if (methodName == 'queryCustomLabel') {
return queryCustomLabel(input);
}
// If no valid method found
output.put('error', 'Invalid method name');
return output;
}
/**
* Method to query Account with translated picklist using toLabel()
*/
private Object queryCustomLabel(Map<String,Object> input) {
String recId;
// 📌 Case 1: Callout from DataRaptor Formula
// FUNCTION('SampleRemoteClass','queryCustomLabel', %recordId%)
if (input.containsKey('arguments')) {
List<Object> args = (List<Object>) input.get('arguments');
if (!args.isEmpty()) {
recId = (String) args[0];
}
}
// 📌 Case 2: Callout from OS/VIP Remote Action
else if (input.containsKey('recordId')) {
recId = (String) input.get('recordId');
}
// 📌 Sample Query with toLabel() on Picklist field
List<Account> acc = [
SELECT Name, toLabel(Type)
FROM Account
WHERE Id = :recId
];
output.put('result', acc);
return output;
}
}
000390590

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.