Custom metadata types (new items)

How to deploy a new custom metadata item

Valerio Chang avatar
Written by Valerio Chang
Updated over a week ago

When deploying a new custom metadata item, you may be confused about which items you need to include in the deployment. This is because custom metadata is composed of two different metadata types: custom metadata and custom object.

Creating a new custom metadata type in Salesforce

When you create a new custom metadata item, the actual definition of this item is a custom object with an _mdt suffix.

Any custom fields you add to this custom metadata item will similarly belong to the custom object.

Before you create any records for the custom metadata item within Salesforce, you will not be able to find any custom metadata items in the comparison. Checking the named items for custom metadata in the filter will also not show any item with the same name as your new custom metadata item.

Deploying the new custom object will create the custom metadata object in your target.

Adding records to your custom metadata object

Once you have added records to your custom metadata object, you will then be able to find custom metadata in the comparison.

You will now also be able to see the record appear under the list of custom metadata named items.

To deploy this new custom metadata record, you will need to ensure the custom object it belongs to is also deployed, or you will get this error.

Summary

If you have no records added to your custom metadata object, then you will not be able to find any custom metadata items in your comparison. Deploying just the custom object of the custom metadata will create the custom metadata container in your target. To deploy a new custom metadata record, its container custom object also needs to be deployed.

Did this answer your question?