loading... Salesforce Cat

Friday, October 17, 2014

Salesforce Record Deletion

In this post I am going to discuss Salesforce record deletion process.In Salesforce once record are deleted those records are moved to the recycle bin and they are no longer accessible through the  SOQL queries or Salesforce standard views.Deleted records are maintained in the recycle bin of 15 days (earlier it was 45 but seems Salesfore has reduced the duration)
refer below link for more details

Salesforce Deleting Records

for more details about recycle bin refer

Salesforce Recycle Bin

All though normal SOQL queries do not return deleted records you can make SOQL queries include deleted records in results by adding "ALL ROWS" keyword at the end of your query.But it is important that you be careful when performing DML operations with such results because the results include deleted records.

example - using ALL ROWS in SOQL

[SELECT COUNT() FROM Contact WHERE AccountId = a.Id ALL ROWS];

In addition to above  approach if you want to explicitly query deleted records only ,you can use "IsDeleted" Standard attribute.

example - using IsDeleted in SOQL

[SELECT Id, Name FROM Account WHERE IsDeleted=true];

No comments:

Post a Comment