Custom Metadata Type is a salesforce feature that allows users to use records without migrating them to their orgs. In Salesforce when we create a custom object MyCompany and add companyA, companyB, companyC records. And when we push that from sandbox to production. All we get is the object, not companyA, companyB, companyC because companyA, companyB, companyC is Data and using changeset, packages we can only transfer metadata.

So Salesforce provides a feature, Custom Metadata Types, to move records in changesets and packages. We can deploy custom metadata objects with records in changeset and packages. Usually, Custom metadata is used to store configurational data of an application.


How to create Custom Metadata:

To create Custom Metadata types, go to Setup –>Custom Metadata Types and then click new custom metadata types button

Fill the required details.


When you create a custom metadata type, you create custom fields on that type. Custom metadata types support most standard field types, including:

  • Metadata Relationship
  • Checkbox
  • Date and Date/Time
  • Email and Phone
  • Number
  • Percent
  • Picklist
  • Text and Text Area
  • URL


Custom metadata type api name ends with “__mdt”.

Once you are done with, you can create records. You can access this in Apex using a SOQL query and  SOQL query for Custom Metadata type is not counted against governor limits. These are not editable in apex but you can edit using Metadata API. Custom Metadata type records are visible in apex test classes without using SeeAllData=true.

Leave A Reply

Please verify that you are not a robot.

Tell us about Your Company

How can we help you with your business?

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home