9

How to retrieve or deploy Custom Metadata Records by ANT Migration Tool?

  1. Is this possible?

I guess it should be possible if this is available for packages and changesets but can't find a way out to do this.

  1. How to do this?

Found some article about this here:

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_custommetadata.htm#meta_custommetadata

<types>
    <members>*</​members>
    <name>Custom​Metadata</name>
</types>

I see error

package.xml - Entity type: 'Custom​Metadata' is unknown
  1. Does anyone knows how to overcome this error?

This should be working since version 31 but it is not working even in version 35.0

  • check above...its same – Mohith Shrivastava Dec 15 '15 at 12:06
  • @MohithShrivastava I agree the question might sound similar but unfortunately it is not answered there. I know that I can do that by Change Set, but here question is if there is any way to do this by ant migration tool, it is not answered there – Patlatus Dec 15 '15 at 12:12
  • @MohithShrivastava if you are able to retrieve or deploy custom metadata records by ant migration tool, please share how do you do that – Patlatus Dec 15 '15 at 12:14
  • sure.Once I am infront of computer I will do this.For sure this is possible – Mohith Shrivastava Dec 15 '15 at 12:39
9

Gosh! This works: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_custommetadata.htm#meta_custommetadata

<types>
    <members>*</​members>
    <name>CustomMetadata</name>
</types>

I just had some invisible character ( &​#8203; Unicode Character 'ZERO WIDTH SPACE' (U+200B) http://www.fileformat.info/info/unicode/char/200b/index.htm ) copied from documentation between small 'm' and capitalised 'M':

<types>
    <members>*</​members>
    <name>Custom​Metadata</name>
</types>
3

Following are the steps to deploy custom metadata using force.com IDE

1)Make sure to download the latest force.com Migration tool from your salesforce instance

Setup | Tools

enter image description here

2)Drop the ant-salesforce jar into your lib of the ANT directory

sample path--C:\Program Files\apache-ant-1.9.0\lib

3)Use proper package XML as shown below

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

4)Run the ant retrieve to fetch all custom metadata files enter image description here

5)Change the build.properties username and password to point to right instance and run ant deploy command

  • Yes, thanks, everything I have done yesterday, and it didn't work for me since I copied the wrong code from documentation: <types> <members>*</​members> <name>Custom​Metadata</name> </types> only when I removed non-visible zero width space character it worked – Patlatus Dec 16 '15 at 13:18
3

Once you have Force.com Migration Tool set up, you can also choose to deploy individual CustomMetadata records using the following format:

<types>
    <members>MetadataObjectName.Record1Name</members>
    <members>MetadataObjectName.Record2Name</members>
    <name>CustomMetadata</name>
</types>

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.