Custom Metadata: Configure Default Field Values with Custom Metadata Types

Reference a custom metadata type record in a default value to simplify updating fields. If the default field value changes, you can update it in the custom metadata type instead of updating multiple field references.

Where: This change applies to Lightning Experience and Salesforce Classic in Professional, Enterprise, Performance, Unlimited, Developer, and Database.com editions. Professional Edition orgs can create, edit, and delete custom metadata records only from types in installed packages.

Why: Let’s say that your org applies different discount rates to opportunities.
  1. Create a custom metadata type. In this example, we name it DiscountPercent.
  2. Create a custom field for your type named discount.
  3. Create a record, and name it IT.
  4. Create a custom field on the Opportunities object, and name it Discount Rate.
Note

Note

The formula editor does not include custom metadata field types. Reference the custom metadata field value manually. The TEXT() function for picklists is not supported.

When done, you can reference the custom metadata field value as a default value to populate the Discount Rate field. The syntax is:
$CustomMetadata.CustomMetadataTypeAPIName.RecordAPIName.FieldAPIName
Use the correct suffixes. For the custom metadata type, use __mdt. For fields, use __c. Records require no suffix. Our example looks like this:
$CustomMetadata.DiscountPercent__mdt.IT.discount__c
When the maximum discount amount changes, you can make the update in one location.
Tip

Tip

Remember that users can override default values if you don’t make the field settings read-only.