We have data that will have picklist values that have been translated on salesforce using the translation workbench.

I have used simplesalesforce to connect to the rest api and that is working just fine.

What i need to be able to do is, in python, access the translated picklist values via the metadata api.

using https://github.com/sun30nil/python-SalesforceMetadataAPISupport I have been able to connect to the metadata api and make a listMetadata request.

What I need to know is I have an object and a field on that object what metadata api calls do I need to make to pull that data out?

I have looked at other similar questions but they haven't referenced the calls but what appears to be java code structured from the WSDL which is no help to me. I need to simulate calls but I'm not sure which.

  • 1
    There's no API to get the label for a specific language, is that what you're after? You would have to set up a separate integration user for each language.
    – Adrian Larson
    Aug 26, 2016 at 21:25
  • yes I am, could I change the language of the user I have logged in via either the rest or metadata api?
    – lathomas64
    Aug 26, 2016 at 21:26
  • There are a few fields that should control it on the User object: LanguageLocaleKeyand LocaleSidKey. I don't have any recommendations about usage in your context but you can play around with that.
    – Adrian Larson
    Aug 26, 2016 at 21:40

1 Answer 1


Using SalesforceMetadataModule.py as a template I was able to add to this python metadata api code a readMetadata method:

def readMetadata(self, metaType, fullNames):
    Read Metadata from salesforce
    :param metaType: The type of data ex. CustomObjectTranslation
    :param fullNames: the full name of the object from ListMetadata
    :return: metadata for the object requested

    headers = {'content-type': 'text/xml', 'SOAPAction': 'retrieve'}
    body = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
           <met:sessionId>""" + self.sessionId + """</met:sessionId>
           <met:type>""" + metaType + """</met:type>
           <met:fullNames>""" + fullNames + """</met:fullNames>

    response = requests.post(
        self.metadataServerUrl, data=body, headers=headers)
    listOfResult = xmltodict.parse(response.content)
    return listOfResult['soapenv:Envelope']['soapenv:Body'][u'readMetadataResponse'][u'result']

Which I was able to pull translations from by doing readMetadata("CustomTranslationObject", object-name)

Seeing what translations are available via listMetadata("CustomTranslationObject, "37.0") and parsing through that input.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .