question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Metadata#retrieve(options) examples

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
0cvcommented, Nov 19, 2016

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'
      }]
    }
  })
0reactions
gonardfreemancommented, Aug 22, 2018

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 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Step 3: Retrieve Components with Metadata API
Two Options for Metadata API Retrieve ... You can use one of two commands to retrieve metadata components. ... Metadata retrieve() is an...
Read more >
XML Package to retrieve metadata from Org - Salesforce Diaries
So, All you need is a XML package to retrieve metadata either from VS Code or Workbench. I have provided a sample XML...
Read more >
Metadata API Developer Guide
Sample that logs in and shows a menu of retrieve and deploy metadata options. */ public class FileBasedDeployAndRetrieve {.
Read more >
How To Retrieve All Metadata from Your Salesforce Org using ...
Option 1: Create a Sandbox · Option 2: Use package.xml with ANT or SFDX CLI · Option 3: Use a 3rd Party Extension...
Read more >
Salesforce-metadata-xml File to Retrieve/Deploy Components
Visit the Workbench site and login with your username and password. 3. Click the Migration tab. 4. Select the Retrieve option. 5. In...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found