Delete Metadata Scenarios

Updated 2 months ago by Copado Solutions

The Destructive Changes operation allows you to delete a component in Git and in the destination environment. If you use this option in a user story, the component will be deleted both from Git and from the user story. However, if you just want to delete the component in Git, you can use this option in a Git snapshot.

There are different scenarios where you may want to use this operation Here, we will describe some of them in more detail.

The Wrong Metadata Has Been Deployed to Production

  1. Delete the item in your lowest development org.
    1. Change other metadata if required.
  2. Create a clean-up user story linked to your dev org. Follow a naming convention for the user story Title in order to be able to find the user stories more easily.e.g. Delete: Remove Component XYZ
  3. Click on Commit Changes and select Destructive Changes as Git Operation type.
  4. As you already have deleted the element in your current org, select the org credential of one of the the following orgs. This will change the metadata grid so you can select the deleted item, however the commit will be against your dev org.
  5. Commit the item you would like to delete. Provide a meaningful commit message.
  6. If you have to commit other changes, click again on Commit Changes and commit the modified items.
  7. Promote the user story to production.

The Wrong Metadata Has Been Deployed to QA/UAT

The Item You Need to Delete Is Not Part of a Current User Story Selection
  1. Delete the item in your lowest development org.
    1. Change other metadata if required.
  2. Create a clean-up user story linked to your dev org. Follow a naming convention for the user story Title in order to be able to find the user stories more easily.e.g. Delete: Remove Component XYZ
  3. Click on Commit Changes and select Destructive Changes as Git Operation type.
  4. As you already have deleted the element in your current org, select the org credential of one of the following orgs. This will change the metadata grid so you can select the deleted item, however the commit will be against your dev org.
  5. Scroll down and expand the Advanced section below the metadata grid.
  6. Provide the QA/UAT org branch name as a new base branch.
  7. Commit the item you would like to delete. Provide a meaningful commit message.
  8. If you have to modify other items, click again on Commit Changes and commit the modified items.
  9. Promote the user story to the environment and do not move it any further.
The Item You Need to Delete Is Part of a Current User Story Selection
  1. Delete the item in your lowest development org.
    1. Change other metadata if required.
  2. Move your original user story back to the environment where you made the deletion and changed your metadata to delete it properly.
  3. In the original user story, go to Commit Files and select Recommit Changes as Git Operation type. Also ,check the Recreate Feature Branch checkbox.
  4. In the selection, remove the item(s) you deleted and finish the commit
  5. Create a clean-up user story linked to your dev org. Follow a naming convention for the user story Title in order to be able to find the user stories more easily.e.g. Delete: Remove Component XYZ.
  6. Click on Commit Changes and select Destructive Changes as Git Operation type.
  7. As you already have deleted the element in your current org, select the org credential of one of the the following orgs. This will change the metadata grid so you can select the deleted item, however the commit will be against your dev org.
  8. Scroll down and expand the Advanced section below the metadata grid.
  9. Provide the QA/UAT org branch name as a new base branch.
  10. Commit the item you would like to delete. Provide a meaningful commit message.
  11. Check your commits to make sure that what was committed is what you expected.
  12. Check the Promote Change checkbox in both user stories.
  13. Go to the Branch Management page, select the forward arrow in the environment both user stories are currently in.
  14. Go to the User Stories Ahead tab on the modal, select your user stories and click on:
    1. Promote and Deploy, if you want to deploy both user stories without further intervention.
    2. Create Promotion, if you want to review the promotion branch, add more user stories to the promotion or if you need to do some other modifications prior to the deployment.
The Item Was Deleted in All Salesforce Orgs but It Still Shows in Git
  1. Go to the Git Snapshot record of the main org (production Snapshot).
  2. Click on Commit Files and select Destructive Changes to delete the component in Git.
  3. All the new feature branches created out of the main branch (aka master) will no longer include the item.


How did we do?