I try to read translated picklist values with the metadata API. But i am not able to retrieve the translated values. The returned PicklistValueTranslation objects are only contains the masterlabel but the translations are always empty.

Sample Code (German translations for Lead picklist fields):

MetadataConnection connection = createMetadataConnection( USER, PASS );

ReadResult result = connection.readMetadata( "CustomObjectTranslation", new String[] { "Lead-de" } );
for( Metadata data : result.getRecords() )
    CustomObjectTranslation objectTranslation = (CustomObjectTranslation)data;
    for( CustomFieldTranslation fieldTranslation : objectTranslation.getFields() )
        System.out.println( "Field: " + fieldTranslation.getName() );
        for( PicklistValueTranslation value : fieldTranslation.getPicklistValues() )
            System.out.println( value.getMasterLabel() + " -> " + value.getTranslation() );


Field: Rating
   Cold -> 
   Hot -> 
   Warm ->
Field: salutation__c
   001 -> 
   002 -> 
   003 -> 
   004 -> 

Translation workbench:

Translation workbench

The example is written with the Force.com Web Service Connector. I also tried it with the excellent apex-mdapi library (metadata api wrapper for apex) with the same result.

I am a bit confused because these values should be available, i can see the translated values in the XML files generated by the mavensmate IDE when i connect it to my organisation (which as far as i know is using the metadata api behind the scenes).


When the file based metadata API (retrieve request) is used, the .objectTranslation XML files contains the translated values. But only if the object field (.object file) is retrieved in the same request. If the request only retrieves object translations the .objectTranslation files are empty.

  • The problem only occurs in one (old) developer organisation. I opened a salesforce support case for this, but it doesn't help to find the root cause or why it doesn't work in this specific org. I can't reproduce the described behavior in any other org.
    – lgraf
    Mar 2, 2016 at 10:39


You must log in to answer this question.