ContainerAsyncRequest

Allows you to compile and asynchronously deploy a MetadataContainer object to your organization.

Version 

Introduced in API version 26.0.

Supported SOAP API Calls 

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

Supported REST API Methods 

GET, HEAD, PATCH, POST, Query

Special Access Rules 

  • As of the Spring ‘20 release, to access ContainerAsyncRequest you must have both the View All Data and Customize Application user permissions.

Fields 

DeployDetails 

  • Type: complexvalue

  • Required: No

  • Properties: Nillable

  • Introduced: API version 31.0

  • Description: Provides detailed XML for any compile errors reported during an asynchronous request. Includes componentFailures. Replaces the JSON field CompilerErrors in Tooling API version 31.0 and later.

ErrorMsg 

  • Type: textarea

  • Required: No

  • Properties: Nillable

  • Description: Errors reported during an asynchronous request.

IsCheckOnly 

  • Type: boolean

  • Required: No

  • Properties: Create, Defaulted on create, Filter, Group, Sort

  • Description: Indicates whether the asynchronous request compiles the code without making any changes to the organization (true) or compiles and saves the code (false).

This field is required.

You can compile without saving but you can’t save without compiling.

  • Default value: false

IsRunTests 

  • Type: boolean

  • Required: No

  • Properties: Create, Defaulted on create, Filter, Group, Sort

  • Description: Reserved for future use.

  • Default value: false

MetadataContainerId 

  • Type: reference

  • Required: No

  • Properties: Create, Filter, Group, Nillable, Sort

  • Description: The ID of a MetadataContainer object.

Specify a MetadataContainerId or a MetadataContainerMemberId, but not both.

  • Relationship name: MetadataContainer
  • Relationship type: relationship
  • Refers to: MetadataContainer

MetadataContainerMemberId 

Specify a MetadataContainerId or a MetadataContainerMemberId, but not both.

  • Relationship name: MetadataContainerMember
  • Relationship type: polymorphic
  • Refers to: MetadataContainerMember, WorkflowAlertMember, WorkflowApexMember, WorkflowFieldUpdateMember, WorkflowOutboundMessageMember, WorkflowRuleMember, WorkflowTaskMember, ValidationRuleMember, AuraDefinitionChange, FtestDeclMd1Member, FtestDeclMd2Member, FtestDeclMd3Member, ApexClassMember, ApexTriggerMember, CustomFieldMember, ApexComponentMember, ApexPageMember

State 

  • Type: picklist

  • Required: No

  • Properties: Filter, Group, Restricted picklist, Sort, Update

  • Description: The state of the request.

This field is required.

  • Possible values:

    • Queued — Queued — the job is in the queue.

    • Invalidated — Invalidated — Salesforce canceled the job because the results might not be valid. This state occurs if someone changes the container members while IsCheckOnly=true, or if a newer compile request is added to the queue.

    • Completed — Completed — the compilation or deployment finished. The SymbolTable fields for the specified object(s) were successfully updated. If IsCheckOnly is false, the Body for each object was saved and the MetadataContainerId field for each object was reset from the ID of the deployed MetadataContainer to the ID of the corresponding ContainerAsyncRequest object.

    • Failed — Failed — the compilation or deployment failed for the reasons stated in the CompilerError field.

    • Error — Error — an unexpected error occurred. The messages in the ErrorMsg field can be provided to Salesforce support if the issue persists.

    • Aborted — Aborted — use this value to delete a queued deployment.

Usage 

When you deploy a ContainerAsyncRequest, you must specify whether to save the compiled entities:

  • To compile entities without saving, set the request to IsCheckOnly=true. This option is only supported if a MetadataContainerMember is specified. A single MetadataContainerMemberId can’t be compiled without saving.
  • To compile and save entities to your organization, set the request to IsCheckOnly=false.

If the compile succeeds, the SymbolTable field is updated on each object in the specified MetadataContainer. If the save or compile fails and a SymbolTable field cannot be updated, the field is cleared. If there is an outstanding save request, all updates, inserts, and deployments fail.

To terminate a queued deployment, set the State field to Aborted.

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