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
4larryj4larryj 

destructiveChanges.xml breaks the build, should not be checked into source control

I like the promise of destructiveChanges.xml (you can finally remove object fields, triggers, etc. as part of your build) but it is unusable for our org.  Including this file renders the build not re-runnable...in other words, it breaks the build after one run in the same environment!

 

If you run it once, great, the elements are deleted.  But if you run it a second time you get errors similar to these:

 

BUILD FAILED

build.xml:62: Failures:

objects/Contract.object(Contract.SetContractToExpired):In field: name - no WebLink named Contract.SetContractToExpired found

objects/Contract.object(Contract.SetContractToCanceled):In field: name - no WebLink named Contract.SetContractToCanceled found

objects/Contract.object(Contract.SetContractToPaused):In field: name - no WebLink named Contract.SetContractToPaused found

 

The build fails when these elements are not found.  But they are not found because they were deleted in a prior run!   The build should not fail if elements to be deleted are not found.  It should either issue warnings or completely ignore, but it definitely should not fail.

 

If this file is included in source control, you will have problems using a continuous integration tool like hudson or cruisecontrol.  You will have problems running the build twice in the same environment.  You will have problems maintaining the file across a team of developers, some of whom have built using the latest destructiveChagnes.xml and some who haven't.  

 

As I'm writing this I realize I should post this on the Ideas board, but I'll post here in case someone has figured out a workaround for this and would like to share.

 

In the meantime we are going to continue to delete elements manually through the UI of every sandbox and production environment, ugh.

 

 

 

gm_sfdc_powerdegm_sfdc_powerde
I hear you.  I don't think there is a decent workaround.  It would be nice if the deployment script throws a soft error on resources in destructiveChanges.xml that are already missing in the target org.  If you post it in Ideas, do add the link here so I and others who share this pain can vote it up.
4larryj4larryj

I just posted on the ideas board, here's the link.

http://ideas.salesforce.com/article/show/10098777/destructiveChangesxml_should_not_break_the_build_if_an_element_to_be_deleted_has_already_been_deleted

 

Let's vote this up!

 

Thanks,

Larry