3

I'm trying to build the package.xml in order to retrieve every single object with all its retriavable fields (I am aware that some fields cannot be retrieved), but I can't seem to achieve it.

When I include this in the file:

<types>
    <members>*</members>
    <name>CustomObject</name>
</types>
<types>
    <members>*</members>
    <name>CustomField</name>
</types>

It only brings me the custom objects and the standard with the custom fields, but not the standard objects with the standard retrievable fields.

How should I make my package file to retrieve everything in one go?

2 Answers 2

9

As per the documentation- Sample package.xml Manifest Files, it looks like you would have to specify the name of objects explicitly:

Standard Objects

<types>
    <members>Account</members>
    <name>CustomObject</name>
</types>

You cannot use an asterisk wildcard to work with all standard objects; each standard object must be specified by name.

All Custom Objects

<types>
    <members>*</members>
    <name>CustomObject</name>
</types>

This manifest file can be used to retrieve or deploy all custom objects. This does not include all standard objects.

Add members to your types on custom objects to specify additional custom objects along with one having wild card character (*), an example below:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <members>Account</members>
        <members>Contact</members>
        <name>CustomObject</name>
    </types>
    <version>41.0</version>
</Package>
6
  • So I understand I would need to include several <member> tags nested in the <types> for CustomObject? That would be one with the wildcard, and another extra for each standard object? Oct 20, 2017 at 9:50
  • Yes, you should explicitly specify standard objects as additional members.
    – Raul
    Oct 20, 2017 at 9:58
  • It is a little confusing that the standard objects are in the CustomObject type and to get all of them would mean a lot of extra lines in the package.
    – Dave Humm
    Oct 20, 2017 at 10:16
  • @DaveHumm it is... but it does seem like it's the only way though. I think SF should update their APIs some day lmao Oct 20, 2017 at 10:43
  • 1
    @JavierGarcíaManzano, custom fields should be available when you add standard objects, please try and let us know the result.
    – Raul
    Oct 20, 2017 at 11:07
0

Raul's approach did not work for me. In my testing, the wildcard on its own pulls custom objects. A specified list on its own can pull standard objects. But combining them in a single manifest just went with the wildcard behavior. I am using API version 52.

My workaround is to retrieve twice with separate manifests.

package-standardObjects.xml

...    
<types>        
            <members>Account</members>
            <members>AccountBrand</members>
            <members>AccountContactRelation</members>
            <members>AccountContactRole</members>
            <members>Activity</members>
            ...
            <members>WorkRewardFundType</members>
            <members>WorkThanks</members>
            <name>CustomObject</name>
        </types>  
...

package.xml

...
<types>        
    <members>*</members>        
    <name>CustomObject</name>
</types>
...

pipeline.yml

...
    sfdx force:source:retrieve -x package-standardObjects.xml --verbose
    sfdx force:source:retrieve -x package.xml --verbose 
...

You must log in to answer this question.

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