Site icon WedgeCommerce

Basics of Custom Metadata Types

Banner

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:

 

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.

Exit mobile version