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.
- First, we need to create a custom MetaData object in salesforce with the required fields.
- 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.
- 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.
- 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
- 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 Comment