Newer Version Available

This content describes an older version of this product. View Latest

Step 2: Build a Package.xml Manifest

The package.xml manifest file lists the components to retrieve from your org.

Package.xml Manifest Structure

The package.xml manifest uses Extensible Markup Language (XML) to identify and migrate metadata components. The basic framework of the package.xml manifest is built with <types> elements. A <types> element specifies which metadata type you want to work with. You can add multiple <types> to a package.xml file.

Inside the <types> element is the <name> element and the <members> element. The <members> element selects for individual components of a specific type, and the <name> element selects for metadata component types. To work with a specific component, input the fullName of the component in the <members> element.

For example, to retrieve Account components, add Account in the <members> element and CustomObject in the <name> element in your package.xml. When you issue a retrieve call, you retrieve only the Account component from your org.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>Account</members>
5        <name>CustomObject</name>
6    </types>
7    <version>64.0</version>
8</Package>

Retrieve Custom Objects

To retrieve all components of a metadata type, you don’t specify the fullName of a component. Instead, use the wildcard character * (asterisk) in the <members> tag. Some components, such as standard objects, don’t support * (asterisk) as a specifier.

To retrieve all custom objects from your org:

  1. (Optional) If you do not have a project folder, use Salesforce CLI to create a new directory that organizes your project. Run this command with your specified project name:

    sf project generate --name YourProjectName

  2. Create a file called package.xml in your project.
  3. In your text editor, open the file and paste in this script:
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>*</members>
5        <name>CustomObject</name>
6    </types>
7    <version>64.0</version>
8</Package>

Now you have a package.xml file that we can use to retrieve all custom objects. When you develop more on your own, you can retrieve more components from your org with multiple <types> elements.