Newer Version Available

This content describes an older version of this product. View Latest

deployRecentValidation()

Deploys a recently validated component set without running Apex tests.

Syntax

1string = metadatabinding.deployRecentValidation(ID validationID)

Usage

Use deployRecentValidation() to deploy your components to production in less time by skipping the execution of Apex tests. Ensure that the following requirements are met before deploying a recent validation.

  • The components have been validated successfully for the target environment within the last 10 days.
  • As part of the validation, Apex tests in the target org have passed.
  • Code coverage requirements are met.
    • If all tests in the org or all local tests are run, overall code coverage is at least 75%, and Apex triggers have some coverage.
    • If specific tests are run with the RunSpecifiedTests test level, each class and trigger that was deployed is covered by at least 75% individually.

This call is equivalent to performing a quick deployment of a recent validation on the Deployment Status page in the Salesforce user interface.

Before you call deployRecentValidation(), your organization must have a validation that was recently run. You can run a validation on a set of components by calling deploy() with the checkOnly property of the deployOptions parameter set to true. Note the ID that you obtained from the deploy() call. You’ll use this ID for the deployRecentValidation() call in the next step.

After you’ve run a validation successfully, use these steps to quick-deploy the validation to the same target environment.

  1. To start an asynchronous quick deployment, call deployRecentValidation() and pass it the ID of a recent validation. This ID is obtained from the previous deploy() call. The deployRecentValidation() call returns the ID of the quick deployment. Note this value. You’ll use it in the next step.
  2. Check for the completion of the call. This process is similar to that of deploy(). Issue a checkDeployStatus() call in a loop until the done field of the returned DeployResult contains true, which means that the call is completed. The DeployResult object contains information about an in-progress or completed deployment that was started by using the deployRecentValidation() call. When calling checkDeployStatus(), pass in the ID value that you obtained in the first step.

Version

Available in API version 33.0 and later.

Arguments

Name Type Description
validationID string The ID of a recent validation.

Response

Type: string

The ID of the quick deployment.