Getting Field Header error when they match, even with Sample csv
Keep getting Header error when field names match. I even created a test Custom Metadata to match the sample csv file in Git. Got this error using sample file from Git: "Header must contain the api names of the fields.
Fields allowed for this type: (DeveloperName, Label, Description, ns1_CountryCode__c, ns1_CountryName__c)
Fields in file header: {Label, ns1__CountryCode__c, ns1__CountryName__c}"
sample.csv
I'm having the same problem as rdclk23.
Error:Header must contain the api names of the fields.
Fields allowed for this type:
(DeveloperName, Label, Description, Active__c, Email__c, Notification_Group__c)
Fields in file header: {Active__c, Description, Email__c, Label, Notification_Group__c, DeveloperName}
I even copied and pasted the api names from your error message and it still wont work. Local Regional.csv
I'm having the same issue:
"Header must contain the api names of the fields.
Fields allowed for this type: (DeveloperName, Label, Description, Region__c, Sub_Region__c)
Fields in file header: {Description, Label, Region__c, Sub_Region__c, DeveloperName}"
This issue is probably caused by Excel adding hidden characters to the CSV file, such as the UTF byte order mark (BOM).
In the CSVFileUtil Apex class, replacing line 17 with the following worked for me. It removes all non-US-ASCII characters from the input.
String contents = csvFileBody.toString().replaceAll('[^\\x00-\\x7F]', '');
Alternatively, I would experiment with different CSV encoding, or try a different application like LibreOffice.