Could you please provide an example on how to use the Metadata#retrieve(options)? Assuming I have a manifest file (e.g. _package.xml_), how do I tell the Metadata#retrieve(options) to retrieve the metadata based on the _package.xml_? I'm not quite sure what the packageNames stands for in the request options { packageNames: [ 'My Test Package' ] }.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>MyCustomObject__c</members>
<name>CustomObject</name>
</types>
<types>
<members>*</members>
<name>CustomTab</name>
</types>
<types>
<members>Standard</members>
<name>Profile</name>
</types>
<version>30.0</version>
</Package>
Thanks in advance!
obs: You could label this as question and not a issue.
If you use packageName option, it is assumed that a package named packageName is already deployed to target Salesforce organization, and retrieve its content as zip archived stream. Here package.xml file is not used at all.
I also had the exact same question, I can not find anywhere what values are accepted in the options object. There is no example. I think the initial question was the same, but you have only partially answered it ... can you please share more documentation on what can I write in the option parameters ?
The message structure is the same as original API provided by salesforce. You can check it in the developers guide in https://www.salesforce.com/us/developer/docs/api_meta/ .
Did anyone ever come up with a working example of this?
Essentially what I'm trying to achieve is:
jsforce-retrieve -u ###### -p #### -l https://test.salesforce.com -P ./src/package.xml -D ./src
I use gulp/jsforce to deploy but can't figure out how to handle retrieves even after referencing the metadata documentation on retrieve requests: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieve_request.htm
@omniphx if you are using jsforce-retrieve the jsforce/jsforce-metadata-tools source code includes the live code how to do the retrieve.
For clarity, unpackaged expects the package.XML formatted as JS object (and not as file). That would be a valid request:
conn.metadata.retrieve({
apiVersion: '38.0',
singlePackage: true,
unpackaged: {
types: [{
'members': ['Account', 'Contact'],
'name': 'CustomObject'
}, {
'members': ['*'],
'name': 'ApexClass'
}]
}
})
Thanks @Krisa! That helps alot. Was under the impression that CLI API was very similar to the jsforce library. Oh well, guess that's not the case
Thanks @Krisa ! Why there is no info about that in docs? How dev need to understand that he could repeat xml structure in js object? Please update docs. Your tool is real powerfull ;)
Most helpful comment
For clarity,
unpackagedexpects the package.XML formatted as JS object (and not as file). That would be a valid request: