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
Mel LisauMel Lisau 

Why doesnt deleting objects from an Organization using destructivechanges.xml and package.xml actually delete the object ?

I have a destructivechanges and package.xml file+

package.xm
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>51.0</version>
</Package>

Destructivechanges.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>myCustomObject__c</members>
        <name>CustomObject</name>
    </types>
</Package>


I have tried with the latest API Version and even though I have specified only 1 custom Object to delete, it actually deletes all of them and even the flag purgeondelete doesnt actually purge , I still have to manually delete the deleted objects, why is this ?
ANUTEJANUTEJ (Salesforce Developers) 
Hi Mel,

As mentioned in https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/daas_destructive_changes.htm

You can’t use destructiveChanges.xml to delete items that are associated with an active Lightning page, such as a custom object, a component on the page, or the page itself. First, you must remove the page's action override by deactivating it in the Lightning App Builder.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
Mel LisauMel Lisau
Hi,
thanks for the reply So if you dont mind I will share my code. I have followedthe details on the link you have sent.
So I have a customobject called myCustomObject__c as in the .xml above and there are no triggers or classes linked or assocaitedwith it. So I call the following to purge  this and not have it in the deleted objects.

      var zipBytes = File.ReadAllBytes(@"D:\delcustom\DelCustom.zip");
      var base64zipbytes = System.Text.Encoding.UTF8.GetBytes(Convert.ToBase64String(zipBytes));
      var resultDelete = _metaService.deploy(base64zipbytes, new DeployOptions() { purgeOnDelete = true, singlePackage = true });
      var deployResult = _metaService.checkDeployStatus(resultDelete.id, true);

Once this is called I would expect the custom object to no longer be there .It doesnt seem to delete. Is there a flag I am not setting ?
 
Mel LisauMel Lisau
Any help with this ? When i look at the deployResult ,it says failed, but howcan i know why it failed ,there is no detailed information in  regards to that ?