---
schema_version: "1"
id: b5230939e35d975849345841a55eb7c10f08ef0012b13875c9e7fa8e388fab66
title: DeployContainer Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_Metadata_DeployContainer.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_DeployContainer.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8874447fb5cbce539c951ffe9acef3f22d78df5c9d784211e4594932df5665b2
description: Represents a container for custom metadata components to be deployed.Add a custom metadata component to the container.Makes a duplicate copy of the Metadata.DeployContainer.Retrieves a list of custom metadata components from the container.Removes a metadata component from the container.Removes a metadata component from the container using the component’s full name.
---
# DeployContainer Class

Represents a container for custom metadata components to be deployed.

## Namespace

[Metadata](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Metadata.htm "The Metadata namespace provides classes and methods for working with custom metadata in Salesforce")

## Usage

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

## Example

// Use DeployContainer for deployment
Metadata.DeployContainer mdContainer = new Metadata.DeployContainer();
mdContainer.addMetadata(customMetadata);

...

// Enqueue deploy
Metadata.Operations.enqueueDeployment(mdContainer, callback);

- **[DeployContainer Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_DeployContainer.htm#apex_Metadata_DeployContainer_methods)**

## DeployContainer Methods

The following are methods for DeployContainer.

- **[addMetadata(md)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_DeployContainer.htm#apex_Metadata_DeployContainer_addMetadata)**  
    Add a custom metadata component to the container.
- **[clone()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_DeployContainer.htm#apex_Metadata_DeployContainer_clone)**  
    Makes a duplicate copy of the Metadata.DeployContainer.
- **[getMetadata()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_DeployContainer.htm#apex_Metadata_DeployContainer_getMetadata)**  
    Retrieves a list of custom metadata components from the container.
- **[removeMetadata(md)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_DeployContainer.htm#apex_Metadata_DeployContainer_removeMetadata)**  
    Removes a metadata component from the container.
- **[removeMetadataByFullName(fullName)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_DeployContainer.htm#apex_Metadata_DeployContainer_removeMetadataByFullName)**  
    Removes a metadata component from the container using the component’s full name.

### addMetadata(md)

Add a custom metadata component to the container.

#### Signature

public void addMetadata(Metadata.Metadata md)

#### Parameters

- **md**:
    
    Type: [Metadata.Metadata](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_Metadata.htm#apex_class_Metadata_Metadata "An abstract base class that represents a custom metadata component.")
    
    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](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[Metadata.Metadata](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_Metadata.htm#apex_class_Metadata_Metadata "An abstract base class that represents a custom metadata component.")\>

### removeMetadata(md)

Removes a metadata component from the container.

#### Signature

public Boolean removeMetadata(Metadata.Metadata md)

#### Parameters

- **md**:
    
    Type: [Metadata.Metadata](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_Metadata.htm#apex_class_Metadata_Metadata "An abstract base class that represents a custom metadata component.")
    
    Meta
    
    data component to remove.

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

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](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    Full
    
    name of the component to remove.

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

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