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 

Is there a SOQL call to clear Deleted Objects ?

I have deleted a number of Objects and they have relationships and links. Is there an SOQL call or any other type of way i can make to clear these from the "Deleted Objects" instead of manually going and deleting them ?
ANUTEJANUTEJ (Salesforce Developers) 
Hi Mel,

>> https://salesforce.stackexchange.com/questions/69926/deleting-custom-object-via-destructivechanges-xml-and-metadata-api-deploy

>> https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_deleting_files.htm?search_text=destructive%20changes

The above link shows how to delete objects via metadata you can try this in the demo org.

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
I can see what they have done , but being relatively new to Salesforce , i need a step by step example I can follow to be able to try this .
ANUTEJANUTEJ (Salesforce Developers) 
So, you can use ant or workbench to deploy the destructive changes package.xml once you have mentioned the necessary object names.

One way is to use ant for this you need to first install the ant and then you can follow this documentation to deploy the package.xml: https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/daas_destructive_changes.htm

Another way is to use the workbench, for this you can check this link: https://developer.salesforce.com/forums/?id=9060G000000BioCQAS
In the above link for workbench they are removing classes, even for objects the steps are still the same.

I hope this helps, please mark this as the best answer so that it can be useful to others in the future.

Thanks.
Mel LisauMel Lisau
I manage to delete the custom records . I would have thought they would then be in the recycle bin. I then go to empty the recycle bin via the following:

        public void EmptyRecycleBin(String[] ids)
        {
                EmptyRecycleBinResult[] result = _myservice.emptyRecycleBin(ids);
                for (int i = 0; i < result.Length; i++)
                {
                    EmptyRecycleBinResult result = emptyRecycleBinResults[i];
                }           
        }
but by the looks of it , it doesnt actually delete the custom objects. Can i set the purgeOnDelete when deleting these objects ?