MetadataContainer

Manages working copies of ApexClassMember, ApexTriggerMember, ApexPageMember, and ApexComponentMember objects, including collections of objects to be deployed together.

Version 

Introduced in API version 26.0.

Supported SOAP API Calls 

create(), delete(), describeSObjects(), query(), retrieve(), update(), upsert()

Supported REST API Methods 

DELETE, GET, HEAD, PATCH, POST, Query

Special Access Rules 

  • As of the Spring ‘20 release, to access MetadataContainer you must have the View All Data user permission and either the Author Apex user permission or the Customize Application user permission.

Fields 

Name 

  • Type: string

  • Required: No

  • Properties: Create, Filter, Group, idLookup, Sort, Update

  • Description: The name of the MetadataContainer. If a container with the same name already exists, an error is reported on create() or POST.

This field is required.

Usage 

Use a MetadataContainer as a package for your tool’s workspace. As a user works in the tool, update the ApexClassMember, ApexTriggerMember, ApexPageMember, and ApexComponentMember objects in the MetadataContainer and use a ContainerAsyncRequest object to save and deploy changes to the current organization.

A MetadataContainer can be reused, but container members can’t.

  • When a ContainerAsyncRequest completes successfully, the MetadataContainerId field on all container members is changed from the ID of the MetadataContainer to the ID of the ContainerAsyncRequest. At this point, container members can no longer be modified or deployed, and can’t be queried via the MetadataContainer; you have to query the ContainerAsyncRequest to see what was deployed.
  • If the deployment fails, container members remain on the MetadataContainer and can still be modified until they are successfully deployed on another ContainerAsyncRequest. The MetadataContainerId field on the completed (failed deployment) ContainerAsyncRequest is set to the ID of the MetadataContainer, so you can have multiple completed ContainerAsyncRequests on a single MetadataContainer.

Deleting a MetadataContainer deletes all objects that reference it.

Note

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!