Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

DeployContainer Class

Represents a container for custom metadata components to be deployed.

Namespace

Metadata

Usage

Use Metadata.DeployContainer to manage custom metadata components for deployment. A container must have one or more components before being deployed.

Example

1// Use DeployContainer for deployment
2Metadata.DeployContainer mdContainer = new Metadata.DeployContainer();
3mdContainer.addMetadata(customMetadata);
4
5...
6
7// Enqueue deploy
8Metadata.Operations.enqueueDeployment(mdContainer, callback);

DeployContainer Methods

The following are methods for DeployContainer.

addMetadata(md)

Add a custom metadata component to the container.

Signature

public void addMetadata(Metadata.Metadata md)

Parameters

  • md:

    Type: Metadata.Metadata

    A custom metadata component class that derives from Metadata.Metadata. Avoid adding components to a Metadata.DeployContainerthat have the same Metadata.Metadata.fullName because it causes deployment errors.

Return Value

Type: void

clone()

Makes a duplicate copy of the Metadata.DeployContainer.

Signature

public Object clone()

Return Value

Type: Object

getMetadata()

Retrieves a list of custom metadata components from the container.

Signature

public List<Metadata.Metadata> getMetadata()

Return Value

Type: List<Metadata.Metadata>

removeMetadata(md)

Removes a metadata component from the container.

Signature

public Boolean removeMetadata(Metadata.Metadata md)

Parameters

Return Value

Type: Boolean

Returns true if the container changed as a result of the call.

removeMetadataByFullName(fullName)

Removes a metadata component from the container using the component’s full name.

Signature

public Boolean removeMetadataByFullName(String fullName)

Parameters

  • fullName:

    Type: String

    Full

    name of the component to remove.

Return Value

Type: Boolean

Returns true if the container changed as a result of the call.