function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Luiz Fernando PeixotoLuiz Fernando Peixoto 

Delete Apex classes/triggers

Is there a way to DELETE apex classes and triggers? I don't want to just inactivate them
SubratSubrat (Salesforce Developers) 
Hello Luiz ,

For your requirement , you need to Install Ant Migration tool , Since Apex code can't be modified directly within a Production organization, it requires steps using Developer tools, like Ant Migration Tool (https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/meta_development.htm) .

Following this article ->  (https://help.salesforce.com/s/articleView?id=000385617&type=1) you would be able to do so .

Or you can also follow this article which deals with deleting the apex classes with workbench ->  (https://appfrontier.my.site.com/kb/s/article/How-to-delete-Apex-Classes-from-your-Production-Org#:~:text=To%20delete%20Apex%20Classes%20in,that%20wildcards%20aren't%20supported.)

And for deleting the trigger you could navigate to related object trigger which you want to delete -> (https://help.salesforce.com/s/articleView?id=sf.code_manage_triggers.htm&type=5)

If this helps , please mark this as Best Answer.
Thank you.
 
toby bishoptoby bishop
Yes, you can delete Apex classes and triggers in Salesforce. However, please note that deleting Apex classes and triggers permanently removes them from your Salesforce organization, and the process cannot be undone. Make sure to back up any important code before proceeding with the deletion.

To delete an Apex class or trigger, you can follow these steps:

1. Log in to your Salesforce organization.
2. Navigate to Setup by clicking on the gear icon in the top-right corner.
3. In the Quick Find/Search bar, type "Apex Classes" or "Triggers" (depending on what you want to delete) and select the corresponding option from the dropdown menu.
4. Locate the class or trigger you want to delete in the list.
5. Check the box next to the class or trigger you wish to delete.
6. Click on the "Delete" button or link (usually located at the top or bottom of the list) to initiate the deletion process.
7. You will be prompted to confirm the deletion. Read the warning message carefully and ensure you have a backup of any necessary code.
8. If you're certain you want to proceed, confirm the deletion. The selected Apex class or trigger will be permanently removed from your Salesforce organization.

Please exercise caution when deleting Apex classes and triggers, as this action cannot be undone. It's a best practice to have proper version control and backups in place for your code to avoid any accidental loss of important functionality.
toby bishoptoby bishop
Yes, you can delete Apex classes and triggers in Salesforce. However, please note that deleting Apex classes and triggers permanently removes them from your Salesforce organization, and the process cannot be undone. Make sure to back up any important code before proceeding with the deletion.
theapk (https://www.theapkasphalt.com)