Metadata is data that describes other data. for instance, in Salesforce org, there's a standard object called Account. Once you add a record with a customer’s contact information to an Account, you add metadata and data.
What is a Custom Metadata Type?
A custom metadata type is an object that's used to define the structure for application metadata. The fields of custom metadata types, and therefore the values in the fields, consist only of metadata. The records of custom metadata types also are metadata, not data.
When you deploy apps with custom metadata types, all of the records and fields are included within the package installation, so no additional steps are needed. you'll deploy custom metadata types from a sandbox with change sets or packaged in managed packages.
Don't forget to check out: Visualizing Salesforce Metadata: Understanding the Relationships with AbstraLinx ERDs
Use Cases for Custom Metadata Types
- Mappings: You can use custom metadata types to make associations between different objects, for instance, you'll create a custom metadata type that assigns cities, states, or provinces to particular regions in a country.
- Business rules: Salesforce has plenty of ways to define business rules. A method is to combine configuration records with custom functionality, for instance, you'll use custom metadata types along with some Apex code to route payments to the correct endpoint.
- Master data: Say that your org uses a typical accounting app. You'll create a custom metadata type that defines custom charges, like duties and VAT rates. If you include this sort as part of an extension package, subscriber orgs can reference this master data.
- Protected information: Store data like API keys during a protected package.
Custom Metadata supports most traditional filed types including the following
- Metadata Relationships
- Date and Date/Time
- Email and Phone
- Text and Text Area
Support To Developer
- Developers can use SOQL to read custom metadata types.
- To create or update metadata records, they will use the Metadata API.
- Apex code can create, read, and update (but not delete) custom metadata records.
Custom metadata types are often used directly from:
- Formula fields
- Process Builder
- Validation rules
Check out another amazing blog here: What are Aura Components in Salesforce? | The Ultimate Guide
Custom metadata types are customizable, deployable, packageable, and upgradeable application metadata.
In many cases, custom metadata types have a plus over custom settings and custom objects.
They can make your application lifecycle management and compliance easier, faster, and more robust.