When deploying a new custom metadata type to a target, you may come across the error: Custom metadata type "X_mdt" is not available in this organization.

How to fix this error

This error is returned by Salesforce because deploying new custom metadata depends on two metadata types: custom metadata and custom object. Deploying just the custom metadata without the custom object will cause the deployment to fail. You need to include both the new custom metadata you are trying to deploy, and the corresponding custom object that it references in your deployment.  

Deploying both the custom metadata and the corresponding custom object will resolve this issue.

Finding the custom object

If you already have custom object included in your metadata filter, you can simply select the appropriate custom object from the comparison table. 

If you can't find your specific custom object, you will need to refresh your filter. Click refresh comparison on the comparison screen and either:

  •  Switch the toggle for custom object to All items , or

  • Switch the toggle for custom object to Named items and include just the custom object your custom metadata depends on

Did this answer your question?