I've been testing to insert a custom metadata type record from a CSV file via Salesforce CLI. I've used below command but I've been getting the following error:


sfdx force:data:bulk:upsert -i Id -f cmdt.csv -s Mapping__mdt -u newuser@salesforce.org


No create/update access for object: Mapping__mdt

Please take note that I use the System Administrator profile, so I am expecting that I have the right access.

It is my first time loading custom metadata type records via CLI, hoping to incorporate Salesforce DX technology in my present and future implementations. Would like to ask for your help regarding this.


Custom Metadata is metadata, meaning you can't use normal data import methods. Use force:source:retrieve to get the contents of Custom Metadata, and force:source:deploy to deploy the metadata. See CustomMetadata for more information on what the files look like.

| improve this answer | |
  • In my case, there are no contents to retrieve yet as custom metadata type records are still in csv file. I saw a tool from Github but upon checking, it only inserts maximum of 200 records in a single call. I have thousand records (quite big, I know, but these are fixed combinations) and I am finding a way to insert all of these at the same time to my DevHub org. – Ertyq May 20 at 6:55
  • @Ertyq You need to transform them to XML-based records, modify the tool to use an "unlimited" amount of updates in batch, or split the file in to chunks. Custom Metadata isn't really meant for thousands of records. You'll quickly reach the limits for storage. – sfdcfox May 20 at 6:58
  • I see. Will check the best approach on this for now, considering also the storage limits provided by Salesforce. Thanks for your immediate response and feedback on this as well. – Ertyq May 20 at 7:15

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.