7

For the first time we started using Custom Metadata types to store our Custom Settings data.

We created a new custom metadta type and created some metadata records for the object

Eg: Metadata object name : CountryMetadata and Created 5 metadata detail rows with 5 countries

I tried to debug the issue with followings;

With Force.com migration tool However when we try to deploy the metadata object to another Org with force.com migration tool this doesn't deploy the metadata detail records to the target Org.

With Force.com IDE : secondly I used the froce.com IDE and pushed metadata records to the target Org and it worked fine (This is a temporary alternative and not what I really want)

With Changesets After all of these attempts, I tried deploy changes through change sets, though this also doesn't have an option to deploy metadata records to the target Org.

My question is how could we deploy CustomMetadata Records with Force.Com Migration Tool?

More Info:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>AccountCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>AccountOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>AnalyticSnapshot</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>ApprovalProcess</name>
    </types>
    <types>
        <members>*</members>
        <name>AuthProvider</name>
    </types>
    <types>
        <members>*</members>
        <name>CallCenter</name>
    </types>
    <types>
        <members>*</members>
        <name>CampaignCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CampaignOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CaseCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CaseOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>Community</name>
    </types>
    <types>
        <members>*</members>
        <name>ConnectedApp</name>
    </types>
    <types>
        <members>*</members>
        <name>ContactCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>ContactOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomApplication</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomLabels</name>
    </types>
    <types>
        <members>*</members>
        <name>Custom​Metadata</name>
    </types>
    <types>
        <members>*</members>
        <members>Account</members>
        <members>AccountContactRole</members>
        <members>Activity</members>
        <members>Asset</members>
        <members>Campaign</members>
        <members>CampaignMember</members>
        <members>Case</members>
        <members>CaseContactRole</members>
        <members>Contact</members>
        <members>ContentVersion</members>
        <members>Contract</members>
        <members>ContractContactRole</members>
        <members>Document</members>
        <members>Event</members>
        <members>Lead</members>
        <members>Opportunity</members>
        <members>OpportunityCompetitor</members>
        <members>OpportunityContactRole</members>
        <members>OpportunityLineItem</members>
        <members>OpportunityTeamMember</members>
        <members>PartnerRole</members>
        <members>PersonAccount</members>
        <members>Product2</members>
        <members>Site</members>
        <members>Solution</members>
        <members>Task</members>
        <members>User</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomObjectOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomObjectTranslation</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomPageWebLink</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomSite</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomTab</name>
    </types>
    <types>
        <members>*</members>
        <name>DataCategoryGroup</name>
    </types>
    <types>
        <members>AllDocuments</members>
        <name>Document</name>
    </types>
    <types>
        <members>ADMIN_Only</members>
        <name>EmailTemplate</name>
    </types>
    <types>
        <members>*</members>
        <name>Flow</name>
    </types>
    <types>
        <members>*</members>
        <name>Group</name>
    </types>
    <types>
        <members>*</members>
        <name>HomePageComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>HomePageLayout</name>
    </types>
    <types>
        <members>*</members>
        <name>Layout</name>
    </types>
    <types>
        <members>*</members>
        <name>LeadCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>LeadOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>Letterhead</name>
    </types>
    <types>
        <members>*</members>
        <name>OpportunityCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>OpportunityOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>PermissionSet</name>
    </types>
    <types>
        <members>*</members>
        <name>Portal</name>
    </types>
    <types>
        <members>*</members>
        <name>PostTemplate</name>
    </types>
    <types>
        <members>*</members>
        <name>Profile</name>
    </types>
    <types>
        <members>*</members>
        <name>Queue</name>
    </types>
    <types>
        <members>*</members>
        <name>QuickAction</name>
    </types>
    <types>
        <members>*</members>
        <name>ReportType</name>
    </types>
    <types>
        <members>*</members>
        <name>Role</name>
    </types>
    <types>
        <members>*</members>
        <name>SamlSsoConfig</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <types>
        <members>*</members>
        <members>ts2__Application__c</members>
        <name>Workflow</name>
    </types>
    <types>
        <members>*</members>
        <name>Settings</name>
    </types>
    <version>35.0</version>
</Package>

Thanks in advance

  • What is your package xml version in your metadata file? Also share metadata you used to deploy via migration tool..what's the migration tool version.. – Mohith Shrivastava Nov 24 '15 at 1:02
  • Kindly note all has to be 35 to get it working.. – Mohith Shrivastava Nov 24 '15 at 1:03
  • Also i find it in changesets from their document . – Mohith Shrivastava Nov 24 '15 at 1:08
  • 1
    Have you double checked that each record is actually in your metadata? You should have some files named Object_Name.Record_Master_Label.md in the customMetadata directory. – Nick Cook Nov 24 '15 at 2:07
  • 1
    I found whats wrong with my Change sets here are the things to add: 1>The custom metadata type object itself (__mdt) 2>Fields of the custom meta data type you created 3>Layout of the custom meta data type 4>Lastly the custom metadata records (you can see the customMetadataType object's name listed in the "Component Type" dropdown ) – Hasantha Nov 24 '15 at 6:01
3

There is some invisible character in documentation between small 'm' and capitalised 'M' in CustomMetadata and in the closing </members> tag (&​#8203; Unicode Character 'ZERO WIDTH SPACE' (U+200B) http://www.fileformat.info/info/unicode/char/200b/index.htm ), that is why this code

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

doesn't work while this would work

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

Thanks to @patlatus! I've Implemented a small groovy script to remove the invisible character. I'm posting it here as an answer so it could be useful for someone.

println "Removes the invisible characters in CustomMetadata"
def customMetadata = ant.fileScanner {
  fileset(dir: '${target.dir}') {
    include(name: 'CustomMetadata/*.md')
  }
}

for (m in customMetadata) {
   m.eachLine { def line ->
    sb.append( line.replace('\u200B', '') )
   }
}
0

It looks like you've resolved this for your change set, but your package.xml is still missing plenty of __mdt components. (CustomObject, CustomField, etc)

These docs might help you (or future readers) better understand how to structure a package.xml using custom metadata:

Metadata API v35 docs from SFDC

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.