- Open your VSCODE IDE and create a project (If you already have project created on your vscode skip this step)
- Authorize your org
- Now fetch the Custom Metadata Type definition from your Salesforce org to your local machine. Click on icon Retrieve Source From Org on ‘Custom Object’.
- Prepare your .csv file and store in your project folder or any folder you want.
- Put the column name same as fields API name.
- Label (Name) API Name can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
- If you have any space or any other special char in “Name” (Label) field replace with underscore(_)
- Open the terminal in VS Code
- Execute this cmdt command. Execute this cmdt command. sfdx force:cmdt:record:insert –filepath .file.csv –typename HDT_AfterthoughtDays__mdt -n Name
Now you will see the all custom metadata type records that have been created in your local machine in project folder.
Right click on Custom Metadata folder and click on “Deploy Source to Org”
<types> <members>*</members> <name>CustomMetadata</name> </types> <types> <members>*</members> <name>CustomObject</name> </types>