You need to sign in to do that
Don't have an account?
Mel 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 ?
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 ?
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.
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 ?