4

I'm trying to use the ant migration tool to retrieve all the Custom Metadata records for a single Custom Metadata Type. However, I can't figure out the syntax.

I would think that something like this would work:

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>State_Sales_Tax.*</members>
        <name>CustomMetadata</name>
    </types>
    <types>
        <members>State_Sales_Tax__mdt</members>
        <name>CustomObject</name>
    </types>
    <version>36.0</version>
</Package>

but no dice.

2

I don't think you would be able to do something like that. You either use a wild card character or mention the names of the individual elements directly.

Something like this.

<types>
    <members>State_Sales_Tax_1</members>
    <members>State_Sales_Tax_2</members>
    <members>State_Sales_Tax_3</members>
    <name>CustomMetadata</name>
</types>

(or)

<types>
    <members>*</members>
    <name>CustomMetadata</name>
</types>
| improve this answer | |
0

Below is the package.xml to retrieve all the custom metadata

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
 <types>
<members>*</members>
<name>CustomMetadata</name>
 </types>
 <version>37.0</version>
 </Package>

You can specify the name to retrieve an individual

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
 <types>
<members>test1</members>
<name>CustomMetadata</name>
 </types>
 <version>37.0</version>
 </Package>
| improve this answer | |
  • Anyway to retrieve the custom metadata type records using sfdx? When I used <members>*</members> <name>CustomMetadata</name> with the sfdx force:source:retrieve command I get the error "The specified metadata type is unsupported" – Rodrigo Sep 17 at 16:43
0

While this isn't possible using wildcards within a package.xml, you can do this with the metadata api by first doing a list call to retrieve all custom metadata types. From there you can filter down to your specific custom metadata type and build a package.xml for a retrieve call.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.