How to Mass Upload Custom MetaData Records in Salesforce Using CSV

| By Ashish Kumar

Salesforce CLI provides a feature to mass insert Records into salesforce using cmdt commands. We can easily insert mass records into salesforce from a CSV file for that we need to follow the following steps.

Step 1:

  • First, we need to create a custom MetaData object in salesforce with the required fields.
    Salesforce Using CSV

Step 2:

  • Retrieve this custom MetaData object in your Vs code from the package.xml File but make sure to include the below tags in your XML files.

Step 3:

  • Custom MetaData objects will be shown in the objects folder of Vs code. Now prepare proper CSV and create a new folder in the project and place that CSV in that folder
  • Make sure your csv column name should be same as the field API Name.

Step 4:

  • Execute the below command to create Records:
    sf cmdt generate records --csv path --type-name custom MetaData Name
    sf cmdt generate records --csv ./Data/CSVfiles/LOBANDCode.csv --type-name LOB_Codes_and_name__mdt

Step 5:

  • Now the new folder will be created in your project called customMetaData with Records, now deploy this folder into Salesforce and your records will be created.

Leave a Reply

Your email address will not be published. Required fields are marked *