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

Permanent deletion of records

I would like to permanently delete records from one of the custom object . basiclly do not want to see any records in recycle bin as the custom objects holds temporary queue records in my app.
Any help will be appreciated.
You could use the Data Loader to perform the delete. First, run an Extract with the data loader for the data you want to delete (ie Select Id from Custom_Object_Name__c). That will output all the data into a CSV file. Secondly, run a Delete with the data loader and use the CSV file as the input file. Once that process is complete, you can empty your organization's recycle bin from the application.

We need to do this automatically in our APEX code. How do we do it using APEX code ?
Apex can perform the query and the delete operations. But beware of the Apex governors in terms of how much data you can return in queries and how much data you can delete via a DML statement. Documentation:|governor|governors|Governor

A few additional questions - how are you going to initiate this apex logic? Via a custom button or trigger? Make sure you add logic to prevent all users from executing this code if you implement it with Apex. I don't think you want to let anyone and everyone truncate an object.

We are calling Apex code from triggers and some through buttons which is using webservice. We are trying to keep the DML and select statements within the limits..

We are using some temporary object to hold queue records to move to the next stage. Once they cross that stage we are deleting them from the temp object . We do not want to see them in Recycle Bin.

Is there any way we can issue a permanent delete on those queue records ?????

Message Edited by p1_dfs on 08-12-2008 03:59 PM