+ Start a Discussion
DS777DS777 

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.
 
Drew1815Drew1815
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 salesforce.com application.

-Andrew
p1_dfsp1_dfs
We need to do this automatically in our APEX code. How do we do it using APEX code ?
Drew1815Drew1815
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: http://www.salesforce.com/us/developer/docs/apexcode/index_CSH.htm#apex_gov_limits.htm?Highlight=Governors|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.
p1_dfsp1_dfs

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