> For the complete documentation index, see [llms.txt](https://docs.flosum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flosum.com/devops/code/branch-actions/rolling-back-a-deployment.md).

# Rolling Back a Deployment

Rollback lets you restore a Salesforce org to its pre-deployment state. It creates a backup automatically, so if errors or unwanted changes occur, you can quickly return the org to stability.

## ![](https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG5ZbxX918xOHwbAwAJ4n%2FSummary2-Small-Icon.svg?alt=media\&token=da26a67f-ff7f-47b3-8669-06be960dc2d7) Overview <a href="#what-is-rollback" id="what-is-rollback"></a>

Rolling back a deployment reverses the metadata changes from a completed deployment. The Rollback feature:

* Uses the pre-deployment backup snapshot stored by the Deploy job.
* Restores components to their original state.
* Ensures stability after a failed or problematic deployment.

Rollback is crucial in production environments where deployment errors must be rapidly corrected.

{% hint style="info" %}

#### Best Practices

* Always validate and test before deploying to minimize the need for rollbacks.
* Rollback all changed components if the deployment caused major issues.
* Use rollback quickly in Production to restore stability.
* Review rollback logs to confirm every component was successfully reverted.
* After rollback, re-validate the branch before redeploying.
  {% endhint %}

## Roll Back a Deployment <a href="#best-practices" id="best-practices"></a>

{% stepper %}
{% step %}

### Select Deployment

{% hint style="info" %}
Only Deploy jobs with a status of **Completed** can be rolled back.
{% endhint %}

1. Click **Branches** from the left sidebar menu.
2. Select a branch from the list.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FHJLnJI70icC0oNUnjYMz%2FRollbackADeployment-S01-01.png?alt=media&amp;token=4bf3bef1-59f7-45f2-9b9c-cd6fd1e00503" alt="" width="563"><figcaption></figcaption></figure></div>
3. Click the **Activities** tab.
4. Find the completed deployment job and click **Deploy** to open the job details.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FEiLbbsrbEBQyQlJjGesi%2FRollbackADeployment-S01-02.png?alt=media&amp;token=aba27c5f-33de-460d-a047-17a1806cb3b8" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Run the Rollback

When performing a Rollback, you will see a list of all components altered during deployment. You can then choose which components to revert.

{% hint style="info" %}
If the **Rollback** button is not visible, then the Deploy job cannot be rolled back.
{% endhint %}

1. Click **Rollback** in the right corner of the Deploy job details page.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FzcHXIDhwy4bkLtVvVQuL%2FRollbackADeployment-S02-01.png?alt=media&amp;token=e160ee9b-7b04-42b7-b573-e64f5398cea9" alt="" width="563"><figcaption></figcaption></figure></div>
2. Click **Select** for each deployed component to revert to the pre-deployment backup.
3. (Optional) Click **Select All** to include all components.
4. Click **Run** to start the rollback.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F24Zlafed9pfD693VC4LM%2FRollbackADeployment-S02-02.png?alt=media&amp;token=d256c52b-2930-4ce6-82c6-21aa24980e21" alt="" width="563"><figcaption></figcaption></figure></div>
5. After starting the Rollback job, it will be displayed on the **Activities** tab.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F4HkAp3NFRMYyoRpoGefQ%2FRollbackADeployment-S02-03.png?alt=media&amp;token=8cb2a5b7-adea-4340-ac10-adacd7c3eed6" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}
{% endstepper %}

## Rollback Results <a href="#how-to-run-rollback" id="how-to-run-rollback"></a>

{% stepper %}
{% step %}

### View Results

1. Click the **Activities** tab.
2. Check that the **Rollback** job status is **Completed**.

{% hint style="info" %}
If an error occurs during the Rollback job, its status will change to **Exception**. Review the Rollback job log to identify the errors.
{% endhint %}

<table><thead><tr><th width="159.6666259765625">Job Status</th><th>Description</th></tr></thead><tbody><tr><td><strong>Queued</strong></td><td>Job is created and waiting to run.</td></tr><tr><td><strong>In Progress</strong></td><td>Job is running.</td></tr><tr><td><strong>Completed</strong></td><td>Job completed successfully.</td></tr><tr><td><strong>Exception</strong></td><td>Job completed with errors.</td></tr></tbody></table>

3. Click **Rollback** to open the Rollback job details.
4. The **Rollback** results page lists the job information and a detailed log.
   {% endstep %}
   {% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flosum.com/devops/code/branch-actions/rolling-back-a-deployment.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
