June 10, 2011

How to Nuke Your Code, AKA How to Delete from Production

Ok it's been a while since my last post, and this isn't a particularly code-centric update but here we go: As many people will have realised already, deleting code from a production instance of Salesforce is not always the easiest thing to do. The way to do it is to remove the files from your project in Eclispe / Force.com IDE and deploy the src folder to the production org, this then gives you the chance to delete the files from there.

Today I was trying to remove a custom Visualforce controller and the system flat out refused because the page still existed. The catch? I couldn't see the page in the list of pages to delete it first, neither did it have the checkbox for deleting it in the deployment dialog. In the end I found a solution (which is why I'm writing a post) and that turned out to be not to deploy from the sandbox at all, but from an entirely separate developer org. Clearly this developer org didn't have any of the files in our production environment so I was able to choose everything for deletion and blew it all away.

Hope this helps somebody somewhere!