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
DeptonDepton 

Deleted apex classes in sandbox, can I deploy it to production?

Hi,

 

I have deleted 2 classes in my sandbox instance that where from a package. I didn´t need these classes so I deleted both.

 

Is there any way to do the same via eclipse for my production org?

 

I have tried to deactivate these classes but I am getting an error message and the debug log gives me no explanation for this.

Class cannot be saved inactive Salesforce

 

Is there any other way around?  I need to delete those classes in production as I am getting compile errors and many apex test errors that I no longer get in Sandbox after deletion

 

Thanks!!!

Best Answer chosen by Admin (Salesforce Developers) 
tom_patrostom_patros

It might not allow the deletion being a) it's referenced in a package or b) it's referenced in some other code.

 

Try connecting to your production org in the IDE and comment out all the lines of your class except the definition on the first line. It should give you some clues as to why it can't be removed.

 

You can also try just deleting the class from production rather than trying to delete via deployment.

All Answers

tom_patrostom_patros

It might not allow the deletion being a) it's referenced in a package or b) it's referenced in some other code.

 

Try connecting to your production org in the IDE and comment out all the lines of your class except the definition on the first line. It should give you some clues as to why it can't be removed.

 

You can also try just deleting the class from production rather than trying to delete via deployment.

This was selected as the best answer
DeptonDepton

Hi om,

 

Thank you for your help!! 

 

I did it already! before you got back to me. I have done a few changes and deleted these 2 classes that were causing me problems and I really did not need it.

 

All fine!! 

 

Compilation and apx classes test are OK!!

 

Thanks for getting back to me!and i mark yours as the solution!;)