1

How, or can we, update Custom Metadata Types that have a checkbox field using the MDAPI? When I set it to '1' or 'true' in both instances it says

value not of required type:

    <?xml version="1.0" encoding="UTF-8"?>
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <label>AsmHst00510</label>
    <protected>false</protected>
    <values>
        <field>hdone__AuditSettingMapping__c</field>
        <value xsi:type="xsd:string">ASM74</value>
    </values>
    **<values>
        <field>hdone__IsActive__c</field>
        <value xsi:type="xsd:string">yes</value>
    </values>**
</CustomMetadata>

hdone__IsActive__c is a boolean field. Have tried: "TRUE, true, 1, yes" Each results in an error when using SFDX mdapi:deploy

IsActive: value not of required type: yes

I saw this Known Issue but these fields are not > 30 characters anyway. Seemed to happen regardless.

https://success.salesforce.com/issues_view?id=a1p300000008bS6AAI

  • The KI you linked is not apparently related to your issue. Can you please post a demonstration file of what you've tried so far? – sfdcfox Feb 22 at 14:00
1

The issue is that you are specifying incorrect data type.

<values>
    <field>hdone__IsActive__c</field>
    <value xsi:type="xsd:string">yes</value>
</values>

If you provide data type as string, then even if you are providing the value as True, it will throw invalid type error.

Change this to the following and see if it works.

<values>
    <field>hdone__IsActive__c</field>
    <value xsi:type="xsd:boolean">true</value>
</values>
  • Aargh! Why I missed this is that the xml file is auto created when I extract the MDT from our org. In this case it was a DX extension though I think in other cases it was the unofficial Custom Metadata Loader. – user2451 Feb 22 at 14:45

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.