You need to sign in to do that
Don't have an account?
Flywheel Dev
Apex Class and Trigger Deletion CLI Failing without Error Message
I am attempting to delete the following from a production environment using the CLI:
- An Apex class
- The test class for that Apex class
- 2 Apex triggers that I have successfully disabled in production using the Salesforce CLI in VS Code
I am running into an issue now where I am unable to delete these files from prod. I have tried creating a manifest file within my project and creating a new project with manifest.
For the sake4 of looking at something, I have tried deploying the manifest deleting the triggers using the following CLI command:
Where TestMethod is a test method that I know passes. This worked before when I was simply changing the triggers' statuses to Inactive, but it is no longer working now that I am trying to change the statuses to Deleted.
More frustrating, I am not getting any sort of error information to debug with. This is what I get:
- An Apex class
- The test class for that Apex class
- 2 Apex triggers that I have successfully disabled in production using the Salesforce CLI in VS Code
I am running into an issue now where I am unable to delete these files from prod. I have tried creating a manifest file within my project and creating a new project with manifest.
For the sake4 of looking at something, I have tried deploying the manifest deleting the triggers using the following CLI command:
sfdx force:source:deploy -x manifest/deleteApex.xml --testlevel RunSpecifiedTests --runtests testMethod
Where TestMethod is a test method that I know passes. This worked before when I was simply changing the triggers' statuses to Inactive, but it is no longer working now that I am trying to change the statuses to Deleted.
More frustrating, I am not getting any sort of error information to debug with. This is what I get:
*** Deploying v54.0 metadata with SOAP API v53.0 connection *** Deploy ID: [Deploy ID] === Component Failures [0] Type Name Problem ──── ──── ─────── === Test Results Summary Passing: 0 Failing: 1 Total: 1 Time: 0 ERROR running force:source:deploy: Deploy failed.
An Apex Class or Trigger must be removed from a production instance if it's blocking a deployment or is no longer needed. Since Apex code can't be modified directly within a Production organization, it requires steps using Developer tools, like ANT Migration Tool.
NOTE: This is the only way an Administrator or Developer can disable or remove Apex in Production.
Refer the below article for steps to delete the trigger/apex class from production.
https://help.salesforce.com/s/articleView?id=000328218&type=1
https://www.salesforceben.com/way-to-delete-apex-classes-from-production/
If this helps, Please mark it as best answer.
Thanks!!
- Salesforce Workbench
- SF CLI
- ANT Migrant
- Extension in VSC with destructiveChanges.xml and only clicks
- some other solutions might be out there. (Copado, Gearset and so on via CI/CD)