1

I am following the documentation here : cmdt command Salesforce CLI

precisely this command :

sf cmdt generate records --csv path/to/my.csv --type-name MyCmdt

I am using a csv file with the first column being the Name, I get the error : The column Name is not found on the custom metadata type MyCmdt

Any help would be greatly appreciated to provide me with a workaround to mass insert Custom Metadata records using VSCode.

2 Answers 2

1

Ok it appears the reason for the error is the encoding of the csv file : mine was in UTF8-BOM, I moved it to UTF8 and it worked like before, with the Name column which does not exist on the Custom Metadata Object.

-1

As the error states, Name is not a field on Custom Metadata Type records. You probably meant to use Label, or possibly DeveloperName here.

You can look at the Custom Metadata Type Object Reference to get a (usually) good idea of what field API names you have to work with.

Using sf project retrieve start -m CustomObject:My_Custom_MD_Type__mdt to get the metadata into your project, and then looking through the files in the fields sub-folder would also get you the field API names.

3
  • Hi Derek thanks for the comment but Label is not working either and Developername neither, the error is just the same except that it says The column DeveloperName is not found on the custom metadata or The column Label is not found on the custom metadata
    – Chris
    Jul 11, 2023 at 11:47
  • Also to be clear I have been doing this for the last 2 years without any issue, and as you can see from the documentation the recommendation is to use the Name column even if it does not exist on the object : Description for cmdt generate records The custom metadata type must already exist in your project. By default, the Name column is used to determine the record name; use the --name-column flag to specify a different column.
    – Chris
    Jul 11, 2023 at 11:49
  • The problem is that all of a sudden this command which used to work perfectly fine has stopped to work, and I can't find any workaround for that.
    – Chris
    Jul 11, 2023 at 11:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .