All You Need to Know About Metadata, Custom Metadata Types and Metadata API
What is Metadata?
Metadata is the data that describes other data. For example, in a Salesforce org, there is a standard object called Account. When you add a record with a customer’s contact information to an Account, you are adding metadata and data.
Field names, such as first name and last name are metadata. The values in those fields, for example, Amit and Raj are data.
Metadata in Salesforce also defines how your org functions. For example, process metadata describes what happens when a user presses the Save button. Presentation metadata concerns the layout of your org, and authorization metadata determines user access. Salesforce metadata also describes your organization’s general configuration. For example, you can configure Chatter to block emoticons in posts.
What is a Custom Metadata Type?
A custom metadata type is an object that is used to define the structure for application metadata. The fields of custom metadata types, and the values in the fields, consist only of metadata. The records of custom metadata types are also metadata, not data.
* Custom metadata types let you configure apps by building reusable functionality that determines the behavior based on metadata, instead of storing hard-coded data.
Don't forget to check out: Visualizing Salesforce Metadata: Understanding the Relationships with AbstraLinx ERDs
What is Metadata API?
Metadata API works with metadata types and components. A metadata type defines the structure of application metadata. A metadata component is an instance of a metadata type.
The fields and values of a metadata type are all metadata. For example, the metadata type CustomTab represents a custom tab that displays content. The CustomTab field has a Sidebar that indicates if the tab is on the sidebar panel, which is an example of metadata determining presentation.
Metadata types like CustomTab build the metadata model that describes how your org is structured, displayed, or functions. Use Metadata API to develop customizations and build tools that manage the metadata model, not the data itself.
Metadata API Functionality
The main purpose of Metadata API is to move metadata between Salesforce organs during the development process. Use Metadata API to deploy, retrieve, create, update, or delete customization information, such as custom object definitions and page layouts.
Metadata API doesn’t work directly with business data. To create, retrieve, update, or delete records such as accounts or leads, use SOAP API or REST API.
Check out another amazing blog by Sejal here: All You Need to Know About Lightning-tabset and Lightning-tabs in Salesforce
You can move metadata in one of two ways. The first method is with Metadata API deploy() and retrieve() calls. Admins often use the deploy() and retrieve() calls to move the full metadata model. These calls are the best fit for the final stages of development, such as deploying tested customizations to the production org.
The second method is source push and pull commands that move only changes in metadata. These commands use source tracking, which makes them friendlier for developers and better for intermediary stages of development.