The Destructive Changes operation is available in the Git Snapshot and the User Story Commit pages. When this operation is selected, the metadata grid appears. An org credential lookup field will also be displayed in the layout.
- If you select a different org credential in the lookup field, the grid is reloaded with the new org credential's metadata items.
- If you cannot find a metadata item in the grid (because it was already deleted), you can click on Add Row located at the bottom of the screen. This button adds a new selected row in the grid and you can type the metadata API name of the component and the metadata type. The cell's text value of the new row must not be empty or include blank spaces.
- When clicking on Commit Changes:
- If committing in a user story, the selected component will be deleted in the feature branch and then merged into the org's branch.
- If committing in a Git snapshot, the metadata will be deleted directly in the main branch.
- Copado will delete the entire file of the selected metadata, if there is one. If the selected components are referenced in other components, these references will also be deleted.
- For example, if a custom object is selected, the changes will be as follows:
- The custom object file will be deleted.
- The object translation file(s) of the custom object will be deleted.
- The layout file(s) of the custom object will be deleted.
- The workflow file(s) of the custom object will be deleted.
- The Sharing Rule, Matching Rule, Assignment Rule, Auto Response Rule and Escalation Rule file(s) of the custom object will be deleted.
- The trigger file(s) of the custom object will be deleted.
- The object permissions of the custom object in profiles and permission sets will be deleted.
- The field permissions of the custom object's fields in profiles and permission sets will be deleted.
Once the destructive changes commit is finished, in the User Story selections you will find the deleted components and any other component that was updated in case it was referencing the deleted component. For example, if a custom object is deleted, in the User Story selections you will find the custom object marked as Git Deletions and also the object's layout, sharing rules, workflow, triggers and any other object-specific component. Additionally, profiles and permission sets that reference the object and its fields (as nested components) appear as Git Upserts, since the reference to the object (OLS) and its fields (FLS) are removed from the profile and permission set XML files.
If you want to delete a component in Git and delete it in the target sandboxes, use this functionality with a user story. If you just want to delete the component in Git, use this functionality with the Snapshot record.