# Rolling Back a CI Job

{% hint style="info" %}
For the best experience, set your browser zoom to **80%** in Chrome or Firefox.
{% endhint %}

The **Rollback** feature enables you to revert a deployment if issues are detected post-deployment or if unintended changes were introduced.

***

### How to Roll Back a Deployment <a href="#how-to-roll-back-a-deployment" id="how-to-roll-back-a-deployment"></a>

This section explains how to roll back a deployment in your CI jobs. The goal is to restore a previous release or deployment state.

***

#### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* The **Rollback** checkbox must be selected when creating the CI job.

***

#### Steps <a href="#steps" id="steps"></a>

1. Navigate to the **CI Job Results** screen.
2. Select the deployment label you want to roll back.
3. Click the **Rollback** icon: ![](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FUevjHyFA6M8y9oRAiTJq%2Fimage.png?alt=media\&token=68128479-7853-446f-87f6-596bd8edbba7)

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FhuRzHqrLDOlZeJWfHFrA%2Fimage.png?alt=media&#x26;token=d48c3c0d-56f5-443e-a2bb-b6fcfcea0720" alt="Rollback Icon Location"><figcaption></figcaption></figure>
4. Under **API Supported > Constructive Changes**, you’ll see the list of metadata components from the original deployment. All are selected by default.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FNXiIP8j1BhOtvTDv0i7j%2Fimage.png?alt=media&#x26;token=483dc804-d55c-432e-8693-e4e077e873c7" alt="Constructive Changes Selection" width="526"><figcaption></figcaption></figure>

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FYn7C7VKtyYXKi6Od78yB%2Fimage.png?alt=media&#x26;token=f2bac77b-1ca7-4268-a3b6-4848ed24a233" alt="Rollback Metadata Overview"><figcaption></figcaption></figure>
5. In **Choose your Pre/Post Destructive Changes**, you can mark metadata present in the destination but absent in the source for deletion. These deletions are logged in the **Rollback Iteration Log**.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FcFy86MdQe0ypSfL5YSU5%2Fimage.png?alt=media&#x26;token=1b29a2f3-e2a8-4b1a-8104-94313b506804" alt="Destructive Changes Selection"><figcaption></figcaption></figure>
6. Choose a method for destructive changes:
   * **Post Destructive Changes**: Deletes components *after* deployment.
   * **Pre-Destructive Changes**: Deletes components *before* deployment starts.

{% hint style="info" %}
**Note:** For active **Flow** metadata, you must include the version number. See [FlowDefinition documentation](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_flowdefinition.htm) for details.
{% endhint %}

7. The **API Un-Supported** section lists metadata types unsupported by the API. You can manually include these as pre or post-destructive changes.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FmOaltXFC4zYLyhJoB0Ud%2Fimage.png?alt=media&#x26;token=64aff702-c5af-41bf-9c0e-1ae1d05d9844" alt="Unsupported API Components"><figcaption></figcaption></figure>

{% hint style="info" %}
**Caution:** Avoid using unsupported API components in rollback, as they may cause rollback failures.
{% endhint %}

***

### Additional Deployment Options

Available configuration options before rollback:

* **Validate Only**: Run a dry-run validation without performing the actual rollback.
* **Deploy Purge on Delete**: Permanently deletes components instead of moving them to the Salesforce Recycle Bin.
* **Ignore Warnings**: Continues rollback even if warnings are encountered.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FLzfRsiUphroxjX3jxfdi%2Fimage.png?alt=media&#x26;token=439b17ee-d06c-41c0-a9e5-49c1d8c70b76" alt="Additional Rollback Options"><figcaption></figcaption></figure>

***

### Apex Test Level

Select an **Apex Test Level** to validate your rollback deployment.

* For details, see [Apex Unit Tests](https://knowledgebase.autorabit.com/product-guides/arm/arm-features/deployment/apex-unit-tests).

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FITWiX9EOG3XZfkmKTaAU%2Fimage.png?alt=media&#x26;token=46b61752-64eb-424c-959b-7e519e9d6531" alt="Apex Test Level Selection"><figcaption></figcaption></figure>

***

### Final Step

9. Click **Rollback** to initiate the process.
10. Once completed, the rollback appears in the **CI Job Results** screen, tagged accordingly. From there, you can:

* View rollback reports
* Download the rollback package
* Re-deploy the rollback if needed
