6

I have created a custom metadata type in my dev org. I want to pull that cmdt (and included fields) down to my machine using the CLI (sfdx command).

I found this command but it only retrieves a record of the given custom metadata type.

sfdx force:source:retrieve -m CustomMetadata:MetadataTypeAPIName.MetadataRecordAPIName

I'm looking for a command that actually retrieves the definition of the custom meta data type itself and not just a single record. I want to do that so the custom metadata type can use VS Code "Deploy Source To Org" to deploy that type in another org and later include it in my managed package.

1 Answer 1

17

To get the Custom Metadata Type itself (including its fields), you use the CustomObject metadata type. The API name just uses __mdt instead of __c.

sfdx force:source:retrieve -m CustomObject:My_Custom_Metadata_Type__mdt

+edit:

update for the sf executable that Salesforce is pushing to replace sfdx

sf project retrieve start -m CustomObject:My_Custom_Metadata_Type__mdt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .