CustomMetadata Class

Represents records of custom metadata types.

Protected custom metadata types behave like public custom metadata types when they are outside of a managed package. Public custom metadata types are readable for all profiles, including the guest user. Do not store secrets, personally identifying information, or any private data in these records. Use protected custom metadata types only in managed packages. Outside of a managed package, use named credentials or encrypted custom fields to store secrets like OAuth tokens, passwords, and other confidential material.

Metadata

Use Metadata.CustomMetadata to represent records of custom metadata types in Apex. For more information, see Custom Metadata Types in the Metadata API Developer Guide.

When you assign namespaces to records, provide full, qualified record names to the app. If both the type and the record are in Namespace, use something like: customMetadata.fullName = 'Namespace__MetadataTypeName.Namespace__MetadataRecordName', where Namespace is a placeholder value.

The following are properties for CustomMetadata.

  • description

    The description of the custom metadata.

  • label

    The label of the custom metadata record.

  • protected_x

    Property that describes whether the custom metadata record is a protected component.

  • values

    A list of custom metadata values, such as custom fields, for the custom metadata record.

The description of the custom metadata.

public String description {get; set;}

Type: String

The label of the custom metadata record.

public String label {get; set;}

Type: String

Property that describes whether the custom metadata record is a protected component.

public Boolean protected_x {get; set;}

Type: Boolean

A list of custom metadata values, such as custom fields, for the custom metadata record.

public List<Metadata.CustomMetadataValue> values {get; set;}

Type: List<Metadata.CustomMetadataValue>

The following are methods for CustomMetadata.

  • clone()

    Makes a duplicate copy of the Metadata.CustomMetadata.

Makes a duplicate copy of the Metadata.CustomMetadata.

public Object clone()

Type: Object