Custom Metadata Type lets you use records to configure your app without worrying about migrating those records to other organizations.
You can deploy the records of custom metadata types from a sandbox with change sets or packaged in managed packages instead of transferring them manually.
With Custom Metadata Types, you can customize, deploy, package, and upgrade application metadata that you design yourself.
The main advantage of the Custom Metadata type is that it does not count towards SOQL query limits for each APEX transaction.
When you create Custom Metadata Type, you also create custom fields on that type. Custom metadata support the below field types:
- Metadata Relationship
- Text Area
Don't forget to check out: All About Custom MetaData Types | The Salesforce Developer Guide
How to create Custom Metadata types?
To create, go to setup -> Custom Metadata Types and click on the new custom metadata types button.
Creating a field under Custom Metadata Type is the same as creating fields under custom objects but with an extra field called Metadata Relationship and a security option called Field Manageability.
Custom Metadata Type Visibility
- All Apex codes and APIs can use the type, and it is visible in Setup (public): As the name suggests, the Custom metadata type is available in public where anyone can see it and all apex codes can access this custom metadata type.
- Only Apex code in the same managed package can see the type (Protected): Custom metadata type is available internally and only the same managed package can access this custom metadata type.
The following are the considerations for the Metadata Relationship field:
- Public custom metadata types cannot be related to protected custom metadata types, but protected custom metadata types can be related to Public custom metadata types.
- Public custom metadata records cannot be related to protected custom metadata records, but protected custom metadata records can be related to Public custom metadata records.
Check out another amazing blog by Sejal here: All you Need to Know About Flows in Salesforce
The following are the limitations of Custom Metadata Type:
- Custom metadata records cannot exceed the size of 10MB.
- It does not support formula field data type.
- Can create only 100 fields per custom metadata type.
- Global picklists are not supported.
- Only 100 Custom Metadata Types can be created per Organization. This number includes all types developed in the organization and installed from managed and unmanaged packages.
- Custom metadata type API name ends with “__mdt”.