function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venkat Koppolu *Venkat Koppolu * 

unable to import custom metadata records using sfdx force:data:tree:import into scratch org

I am trying alternatives to export data and import data using salesforce cli and came across a scenario where I was able to export the custom metadata records but when I try to import the same to another scratch org I am finding CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY  entity type cannot be inserted.

{
    "records": [
        {
            "attributes": {
                "type": "TR1__mapping__mdt",
                "referenceId": "TR1__mapping__mdtRef1"
            },
            "DeveloperName": "LastName_DefaultValue",
            "Label": "LastName DefaultValue",
            "Language": "en_US",
            "MasterLabel": "LastName DefaultValue",
            "QualifiedApiName": "LastName_DefaultValue",
            "TR1__Def_Value__c": "UNKNOWN",
            "TR1__Field_API__c": "LastName",
            "TR1__Node__c": "Contact"
        }
]
}
I see that salesforce allows records deployments with ANT but was curious to know why they allowed export feature but import is not working using salesforce cli commands.

Jonathan CoombsJonathan Coombs
I am running into a similar situation.
Kishan  JKishan J
Salesforce CLI commands for custom metadata types are available from v49 (Summer'20).  Metadata records can be inserted using :

force:cmdt:generate
Generates a custom metadata type and all its records for the provided sObject.
force:cmdt:record:create
Create a new record for a given custom metadata type in the current project.
force:cmdt:record:insert
Create new custom metadata type records from a CSV file.

Check the following links for more information:

Create and Manage Custom Metadata Types Using CLI (https://help.salesforce.com/articleView?id=custommetadatatypes_cli.htm&type=5)

cmdt Commands (https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_cmdt.htm#cli_reference_force_cmdt)
Oscar Iuliano 19Oscar Iuliano 19
Hi, if you want can use this web application:

https://whispering-escarpment-39582.herokuapp.com/

regards