2.6 KiB
Overview
Steps Taken by the developer:
Delete Metadata files -> Add them to appropriate destructive package xmls in destructive-changes
directory
This causes the deploy actions to do the following:
Converts source code in force-app/main/default
to Metadata API format and place files in destructive-changes
directory -> deploy using Metadata API -> skip force:source:deploy
-> On merge to master only: Removes destructive-changes
directory and commits removal to master
Step by Step Guide
-
Identify all files that need to be deleted or updated. When deleting a custom field or object this can be quite a lot of files since you need to delete profile level FLS, permissions, and any references to them in Apex, Flows, etc. Here are some general guidelines/tips:
- You should be able to run the
retrieve
after deleting the metadata in setup to handle most of the file updates. - Removing the
force-app/main/default/profiles/decomposed
BEFORE running theretrieve
script will ensure that what ends up in that directory is exactly what's in your org. - If you delete an entire object, doing a retrieve won't delete those object definition files.
- E.G. If you delete an object called
My_Object__c
, retrieving won't deleteforce-app/main/default/objects/My_Object__c/
- E.G. If you delete an object called
- You should be able to run the
-
Build your destructive package xmls and place them in a folder called
destructive-changes
. The folder must be in the project root. This folder is removed automatically once destructive changes are deployed to prod, so you will most likely have to create the folder. -
Test whenever possible. If you deleted the metadata using Setup, consider refreshing your sandbox and manually running the deploy to your sandbox. To manually deploy to your issue sandbox you can run the following commands, replacing
*ISSUE_NUMBER*
with the sandbox issue number. If you've set a different alias for your sandbox, pass that to the-u
flag instead. Be sure to cleanup the converted metadata when running these commands locally! You can quickly cleanup converted metadata by recursively removing untracked files withgit clean -fd
sfdx force:source:convert -r ./force-app/main/default/ -d ./destructive-changes
sfdx force:mdapi:deploy -d destructive-changes/ -l RunLocalTests -w 200 -u issue-*ISSUE_NUMBER*
- Check in your changes and the action workflows will take it from there.