Loading
Salesforce now sends email only from verified domains. Read More
Enhance Salesforce with Code
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Custom Metadata Types and Advanced Formula Fields

          Custom Metadata Types and Advanced Formula Fields

          When you create a custom metadata type, you can reference its values in an advanced formula field. If a field value changes, you can update it in the custom metadata type instead of changing multiple, hard-coded formulas. If you use packaging, define the logic you want and allow your subscribers to customize the details.

          Required Editions

          Available in: Salesforce Classic and Lightning Experience

          Available in: Enterprise, Performance, Unlimited, and Developer Editions

          You can create, edit, and delete custom metadata type records from installed packages in: Group and Professional Editions

          Example
          Example Let’s say that you want to validate that the amount in the Account object’s Annual Revenue field is greater than 0 and does not exceed $100 billion.
          • Create a custom metadata type. In this example, we name it Min and Max Amounts.
          • Create two custom fields for your type named Minimum Revenue and Maximum Revenue.
          • Create a record, and name it FY19.

          Now reference the custom metadata record in a formula 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.

          Note
          Note Long text area fields aren't supported in formula references.

          Your formula might look like this:

          OR(
             AnnualRevenue < CustomMetadata.AnnualRevenue__mdt.Annual_Revenue.Minimum_Revenue__c,
             AnnualRevenue > $CustomMetadata.AnnualRevenue__mdt.Annual_Revenue.Maximum_Revenue__c
          )
          
          If the minimum and maximum amounts change, make the edit in the custom metadata record instead of in multiple formulas.
           
          Loading
          Salesforce Help | Article