I wanted a Metadata API to get the Spanish translations of Address Country picklist. Using Translations type or Address doesnt help me get the values.
Translations are always retrieved in the user language. You can see their labels and codes with this code snippet:
Schema.DescribeFieldResult fieldResult = Account.BillingCountryCode.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
System.debug(LoggingLevel.INFO, '>>>>> Countries');
for( Schema.PicklistEntry f : ple) {
System.debug(LoggingLevel.INFO, '>>>>> ' + f.getValue() + ' :: ' + f.getLabel());
}
Use query
SELECT id,name, toLabel(yourcountry fieldname) FROM yourobjectname
and get the translated values .
sfdev
-
Thats not what I intend to do. Country Values may or may not be in a record of an object. I want to retrieve the metadata. – Pratibha UR Jul 28 '15 at 3:25