1

I have some apex classes that are no longer needed. I removed all of the code from the files and just left the declaration. There does not seem to be a way to delete the code files that I can find but that is a separate issue.

When I look at code coverage in sandbox Developer Console I see things like (0/806), (0,498), etc... for these files. This is bringing by code coverage down significantly such that I can not deploy to production.

How can I get salesforce to count these as 1 or 2 lines/blocks of code instead of hundreds. I have seen posts saying to clear coverage and test data. I have deleted Test History. The instructions usually point to menus and commands that are not in the current version of Salesforce (I never worked with earlier versions).

I am using Sublime Text with Mavens Mate for my IDE.

I need to deploy big fixes that I have made and I am stuck. Any ideas?

  • Did you remove the code lines for production or sandbox? – Amit Bangad Feb 4 '15 at 16:19
  • In some cases sandbox only, but some were commented out the last time I deployed and did not have an issue. – Maggie Feb 4 '15 at 16:23
2

If you have already pushed them out to production, then you will want to delete them from production if they are no longer in use.

https://help.salesforce.com/apex/HTViewSolution?id=000006188&language=en_US

  • I had marked some of these xml files as Deleted in sandbox as stated in the link and thought if I put them in the change set they would become deleted there too. – Maggie Feb 4 '15 at 16:26
  • I'm nervous about connecting to production with mavensmate since if I compile it moves everything to the server. So do I change the connection to prod only - do I need to pull the prod version of the file down first? – Maggie Feb 4 '15 at 16:28
  • 2
    Connecting Mavensmate, Force.com IDE, etc to prod is a bad idea. You'll have to Run All Tests for every compile cycle, which probably means you'll be able to save only once every 30-60 minutes. You will want to delete those files, but make sure you do it all at once. I'd personally use the Ant toolkit to avoid any catastrophic problems. Build a "destructiveChanges.xml", list the objects to delete, and then try deploying all the changes at once. – sfdcfox Feb 4 '15 at 16:51
  • Can you explain more what you mean? I don't know how to deploy a change set with an xml file - "destructiveChanges.xml". – Maggie Feb 4 '15 at 17:02
  • 1
    Like @sfdcfox suggested, this should get you started on the right path: developer.salesforce.com/page/Propagating_Destructive_Changes – TC Sutton Feb 4 '15 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.