I am trying to deploy a field on a custom metadata type using Ant.

Here's my package.xml:

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

Then inside a customMetadata folder I have a file called nameOfMtdType.NameOfField.md. That file's content looks like this:

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

        <description>The maximum number of balls that are allowed.</description>
        <inlineHelpText>The maximum number of balls that are allowed.</inlineHelpText>
        <label>Number Of Balls</label>

I am getting this error: Error parsing file: Element {http://soap.sforce.com/2006/04/metadata}fullName invalid at this location in type CustomMetadataValue

What am I doing wrong? The content inside the <values></values> is what I pulled from my scratch org using sfdx.

Also, I was trying to follow the documentation from this link: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_custommetadata.htm

Is there a better resource?


The Metadata API type CustomMetadata is for deploying records of Custom Metadata Types, not the schema of the type itself. That's why you're getting back that error - you supplied part of the type definition where Salesforce was looking for record data.

The Custom Metadata Type itself, along with its fields, is deployed as a CustomObject, where properties like fullName are expected. There's an example in that documentation of what it looks like to deploy a Custom Metadata Type field for a type called ReusablePicklistOption__mdt:


<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
      <label>Sorted Alphabetically</label>
   <label>Reusable Picklist</label>
   <pluralLabel>Reusable Picklist</pluralLabel>

The easiest way to handle this, though, is just to let Salesforce DX convert the source for you with the force:source:convert command. You can then trim the converted Metadata API source and package.xml down to deploy just the elements you're interested in, like this single field.

  • Thanks for the sfdx convert command, that's exactly what I used and then just deployed it using ant to the appropriate org. Saved me a ton of time! – Arthlete Aug 29 '18 at 23:13

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.