function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phuc Nguyen 18Phuc Nguyen 18 

Pull specific custom metadata records into VScode

Hello All,
How can I retrieve specific custom metadata records from an org.
I use this syntax for specifc fields

sfdx force:source:retrieve -m CustomField:Object.CustomField__c

But what is the syntax for a custom metadata record?

Thanks,
P

Best Answer chosen by Phuc Nguyen 18
AnudeepAnudeep (Salesforce Developers) 
Hi Phuc, 

I recommend building a Package.xml Manifest and identifying and listing the metadata required to be pulled. You can then run the command
 
sfdx force:source:retrieve -u DevHub -x ./package.xml

User-added image

To learn more, see this Trailhead Module 

If you find the information provided above helpful, please mark this answer as Best. It may help others in the community. Thank You!

Anudeep 

All Answers

AnudeepAnudeep (Salesforce Developers) 
Hi Phuc, 

I recommend building a Package.xml Manifest and identifying and listing the metadata required to be pulled. You can then run the command
 
sfdx force:source:retrieve -u DevHub -x ./package.xml

User-added image

To learn more, see this Trailhead Module 

If you find the information provided above helpful, please mark this answer as Best. It may help others in the community. Thank You!

Anudeep 
This was selected as the best answer
Ruwantha BulegodaRuwantha Bulegoda
You can use the org browser to download specific metadata 
User-added image
Andrew HoveyAndrew Hovey
The correct format for retrieving a specific Custom Metadata Record is:
sfdx force:source:retrieve -m CustomMetadata:MetadataTypeAPIName.MetadataRecordAPIName

For example, if your custom metadata type is API_Endpoints__mdt and the API name of a metadata record is Contact_Server, this would be your command (note that "__mdt" has been removed from "API_Endpoints"):
sfdx force:source:retrieve -m CustomMetadata:API_Endpoints.Contact_Server

 
daddyTofudaddyTofu
^ over a year later andrew actually has the best simple answer, but package.xml file does help you maintain better.