Loading
Feature degradation | Gmail Email delivery failureRead 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
          Add Custom Metadata Type Fields to Existing Packages

          Add Custom Metadata Type Fields to Existing Packages

          Custom metadata type fields can’t be added directly to a custom metadata type that’s in an installed managed package.

          Required Editions

          Available in: Salesforce Classic and Lightning Experience

          Protected custom metadata types in managed packages are available in: Developer Edition and scratch orgs

          Package uploads and installs are available in Group, Enterprise, Performance, Unlimited, and Developer Editions

          Create, edit, and delete custom metadata type records from installed packages Group and Professional Editions

          To add fields,

          1. Create a new unmanaged custom metadata type in your Salesforce org.
          2. Add the new custom fields to the unmanaged type.
          3. Use an entity relationship field to map the new unmanaged type to the managed type.
            1. Create a Metadata Relationship field.
            2. For Related To, select Entity Definition.
            3. On the New Custom Field page, check Required and Unique.
            4. Save the custom field.
          4. Query the managed type to join the unmanaged type to the results and add the fields to the result set.
          Example
          Example You can use two methods to query across the relationship in SOQL: a right-join from the new object that adds new custom fields, or a left-join from the parent object. For example,

          Right join:

          select ManagedCmt__r.Id, ManagedCmt__r.MasterLabel, AnotherField__c from ExtraFieldsCmt__mdt

          Left join:

          select Id, MasterLabel, (SELECT AnotherField__c FROM ExtraFieldsCmts__r) from ManagedCmt__mdt
           
          Loading
          Salesforce Help | Article