Start tracking your progress
Trailhead Home
Trailhead Home

Get Started with Custom Metadata Types

Learning Objectives

After completing this unit, you’ll be able to:
  • Define custom metadata types.
  • Identify several use cases for custom metadata types.


Do you hear your developer talking about app configuration records and wonder what they are? Or, maybe you know what they are and need to migrate app configuration records between Salesforce orgs, but you’re not a developer. In this module, we give you the skinny on app configuration records and how Custom Metadata Types can help you—even if you’re not a developer.

Instead of storing data, app configuration records customize your app’s behavior. For example, if you create a workflow rule, you essentially create a Salesforce record that tells your app how to behave.

Many Salesforce orgs use custom settings or custom object records for app configuration rather than custom metadata types; the process involves:
  1. Creating configuration records in one or more development orgs.
  2. Sending the configuration records through integration and user acceptance testing.
  3. Deploying the records to at least one production org.

Custom settings definitions diagram.

Custom metadata is customizable, deployable, packageable, and upgradeable application metadata. First, you create a custom metadata type, which defines the form of the application metadata. Then you build reusable functionality that determines the behavior based on metadata of that type. You use records to configure your app instead of settings. You can customize, deploy, package, and upgrade application metadata that you design. And you can do much of this work using declarative functionality.

Custom metadata types definitions and records diagram.

Use Custom Metadata Types

Here’s some examples of what you can do with custom metadata types.
  • Mappings—You can use custom metadata types to create associations between different objects. For example, you can create a custom metadata type that assigns cities, states, or provinces to particular regions in a country.

  • Business rules—Salesforce has lots of ways to define business rules. One way is to combine configuration records with custom functionality. For example, you can use custom metadata types along with some Apex code to route payments to the correct endpoint.

  • Master data—Say that your org uses a standard accounting app. You can create a custom metadata type that defines custom charges, like duties and VAT rates. If you include this type as part of an extension package, subscriber orgs can reference this master data.

More About Custom Metadata Types

When you create a custom metadata type, you create custom fields on that type. Let’s consider a simple master data scenario: You want records that store different support tiers you offer to your customers and a discount for each tier. First, you create a custom metadata type called Support Tier. Next, you add fields to 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

Let’s create two custom fields on our type: A Minimum Spending field of type Number and 2 decimal places, and a Default Discount field of type Percent. Minimum Spending will determine how much a particular account needs to spend in order to qualify for a support tier. Default Discount is the automatic discount applied to a specific tier.

After you create the type with all its fields, create custom metadata records that are defined by that type. These records store the actual configuration data. For our example, you create a record for each support tier that’s relevant to your org.

Label Minimum Spending (Custom Field) Default Discount (Custom Field)
Bronze 0 0%
Silver 1,000 10%
Gold 5,000 15%

Later, you can package and install all of these components, including your records, in other orgs. To include more support tiers later, you can add the new records to your package.

Let’s stop reading, though, and create our own custom metadata type in the next unit.