Loading

Cancel an in progress deployment or validation

Дата публикации: Jun 3, 2026
Описание

If you need to cancel a Salesforce deployment or validation that is currently in progress — for example, because you need to deploy a higher-priority update, you realize the deployment will fail, or you see unexpected failures during validation — there are several ways to do so.

What Happens When You Cancel a Deployment

The Salesforce deployment process is a complex, multi-step operation designed to preserve data integrity. When you request a cancellation, the deployment does not stop immediately. Instead, it completes its current step and then processes the cancellation request and executes a rollback of any changes already applied.

How Long Does a Cancellation Take

Because canceling a deployment is itself a multi-step process, it can take some time to complete. The duration depends on several factors: the size of the deployment payload (number of metadata components), the number of components that need to be rolled back, and the relationships and dependencies between those components.
For example, if the deployment is currently processing a single metadata type that contains many files, the cancellation may not be triggered for a significant amount of time because the current step must complete first.

Why Is a Canceled Deployment Still Showing as In Progress

A canceled deployment may continue to show as "In Progress" for some time after the cancellation is requested. This happens because the cancel operation does not directly terminate the deployment process — it signals the process to cancel, and the process completes its rollback steps before changing status. How long this takes depends on the complexity of the rollback.

How to Check the Status of a Cancellation

To check the current status of a cancellation, use the Salesforce Metadata API's checkDeployStatus() method. Also review the article Change Set validation or deployment stuck in In Progress for additional guidance.

Решение

Method 1: Cancel via the Salesforce UI

  1. Navigate to Setup > Environments > Deploy > Deployment Status.
  2. Identify the deployment or validation that is currently in progress.
  3. Click the Cancel button next to the in-progress deployment or validation to request cancellation.

Method 2: Cancel Using the REST API

  1. Authorize access to your Salesforce org's REST API.
  2. Send an HTTP PATCH request to the following REST URI: https://[host]/services/data/v[API Version].0/metadata/deployRequest/[deployRequestId]
  3. The body of the PATCH request must set the deployRequest status to "Canceling".
  4. For detailed instructions, refer to the Cancel a Deployment in Progress Using REST API documentation.

Method 3: Cancel Using Salesforce CLI

  • For metadata deployments, use the command: force:mdapi:deploy:cancel
  • For scratch org source deployments, use: force:source:deploy:cancel
  • Refer to the Salesforce CLI mdapi Commands Reference and the Salesforce CLI source Commands Reference for details.

Method 4: Cancel Using the ANT Migration Tool

  • Use the <sf:cancelDeploy> ANT task to cancel a deployment that is in progress or queued.
  • Refer to the Canceling a Deployment from the ANT Migration Tool Guide for more information.
Номер статьи базы знаний

000392895

 
Загрузка
Salesforce Help | Article