A custom metadata type deploys as two separate things: the type definition, and the records that belong to it. Use this article to work out which components to select in a Gearset comparison for each part, and to deploy a custom metadata type that doesn't exist in your target org yet.
Both parts deploy with compare and deploy, so you don't need a data deployment.
What are the two parts of a custom metadata type?
In a Gearset comparison, a custom metadata type is split across two metadata types. The following table shows what each part is called in a comparison, and what a single component of it represents.
Part of the custom metadata type | Metadata type in the comparison | What one component is |
The type definition |
| The whole type definition, listed under the type's name without a suffix, for example |
The records |
| One record, listed as the type name, a dot, then the record name, for example |
One Custom metadata component is one record. To deploy five records of a custom metadata type, select five Custom metadata components.
The comparison lists the type definition under the type's name only. Salesforce adds the __mdt suffix to the API name, and you see that suffix on the type's custom fields, for example GearsetDocTest__mdt.Text_test.
The type's custom fields sit inside its Custom object component, so you don't select the fields separately. To see them, expand the Custom object row, then expand Components. The GearsetDocTest__mdt Custom object appears in the comparison even when the type has no custom fields at all.
Because the fields are part of the Custom object, your selected item count is higher than the number of rows you clicked. If you select a type definition that has 2 custom fields, plus 2 records, Selected items reads 5 items.
Prerequisites
The custom metadata type and the records you want to deploy exist in your source org. Gearset deploys what it finds in the comparison, so create the type and its records in Salesforce first.
You're using compare and deploy. Custom metadata records deploy as metadata, so no data deployment is needed.
What metadata is needed in the filter?
To deploy a custom metadata type and its records, include both Custom object and Custom metadata in your comparison's metadata filter. Custom object covers the type definition. Custom metadata covers the records.
Once records exist in the source org, each record appears by name in the Named items list for Custom metadata, under Specify named items and rules.
How to deploy a new custom metadata type with Gearset
Follow these steps to deploy a custom metadata type that doesn't exist in your target org yet.
In Salesforce, create the custom metadata type and add the records you want to deploy.
In Gearset, add
Custom objectandCustom metadatato the metadata filter for your comparison.Run the comparison between your source and your target.
Select the
Custom objectcomponent named after your custom metadata type, for exampleGearsetDocTest. This component is the type definition, and it includes the type's custom fields.Select one
Custom metadatacomponent for each record you want to deploy.Click a
Custom metadatacomponent to check it in the comparison pane. Gearset shows the record'sLabelandProtectedsetting, and aValuestable of the record's field values.
Deploy the Custom object that holds the type definition as well as the records. If a Custom metadata record reaches a target org that doesn't have the type definition, Salesforce returns a validation error. For that error, read Resolving validation errors - "Custom metadata type "XXX_mdt" is not available in this organization".
Why can't I find my custom metadata type in the comparison?
If you haven't created any records for the custom metadata type yet, no Custom metadata components appear in the comparison for it, and the type's name doesn't appear in the Named items list for Custom metadata either. That's expected, because a Custom metadata component is a record, and the type has no records yet.
How do I deploy read access to a custom metadata type?
Read access to a custom metadata type is granted through profiles and permission sets in Salesforce, so it's separate from deploying the type and its records. Gearset shows that access inside the Profile or Permission set component rather than as its own line item. Read How to deploy Custom metadata type access and custom settings access for how to retrieve and deploy it.
Any questions?
If you have any questions about deploying custom metadata types, reach out in the in-app chat and one of the team will be able to help you out!



