You need to sign in to do that
Don't have an account?
Dave The Rave
Recycle Bin + add fields
I understand that you cannot add fields to the recycle bin page for a specific tab.
I would like to retrieve deleted records from the CASE object which have a specific recordtype.
I tried to do this in the Developer Console with SOQL but this still does not work.
I read that you need to de an SOQL All Query, I am an administrator.
Can somebody help me out here?
Thanks,
Dave
I would like to retrieve deleted records from the CASE object which have a specific recordtype.
I tried to do this in the Developer Console with SOQL but this still does not work.
I read that you need to de an SOQL All Query, I am an administrator.
Can somebody help me out here?
Thanks,
Dave
You may try in Anonymous Apex window.
List<Case> deletedCases = new List<Case>();
deletedCases = [SELECT Id FROM Case WHERE IsDeleted = TRUE AND RecordType.DeveloperName = 'ICTSupport' ALL ROWS];
system.debug('\nNumber of deleted cases is :\t' + deletedCases.size() + '\nand the cases are :\n' + deletedCases);
All Answers
SELECT Id, CaseNumber, Subject, AccountId, isDeleted FROM Case ALL ROWS
From the dataset that returns, all records that have the isDeleted as TRUE are the ones that reside in the Recycle Bin. Collect Ids of all such records in a list of Cases and perform an Undelete DML on that list.
If you just want to query the records from Recycle Bin, you can add a query filter. For e.g.
SELECT Id, CaseNumber, Subject, AccountId, isDeleted FROM Case WHERE IsDeleted = TRUE ALL ROWS
Maybe this is the ideal query for you (since it just retrieves records from Recycle Bin and minimum information that must be retrieved) -
SELECT Id FROM Case WHERE IsDeleted = TRUE ALL ROWS
You're done.
I copied this into the "Query Editor" in the Dev Console and got an error:
"Unknown error parsing query"
I am only looking to view the deleted case, also with RecordType = 'ICTSupport'
You may try in Anonymous Apex window.
List<Case> deletedCases = new List<Case>();
deletedCases = [SELECT Id FROM Case WHERE IsDeleted = TRUE AND RecordType.DeveloperName = 'ICTSupport' ALL ROWS];
system.debug('\nNumber of deleted cases is :\t' + deletedCases.size() + '\nand the cases are :\n' + deletedCases);
So once retrieved they are just a regular list and you can do whatever you are allowed to do with lists except delete DML again, you can undelete though :).
By the way, Salesforce just holds the most recent 5000 records deleted in the Recycle Bin across users, if a record would cause the number to go beyond 5000, the oldest record in Recycle Bin would be purged to make way for this new entrant.
Also, several standard objects (though the niche ones) never get into Recycle Bin and are always hard deleted. Similarly any records deleted using Hard Delete option available on Apex Data Loader using Bulk API would never make to Recycle Bin.
[SELECT Id FROM Case WHERE IsDeleted = TRUE AND RecordType.DeveloperName = 'ICTSupport' ALL ROWS];
to
[SELECT Id, CaseNumber FROM Case WHERE IsDeleted = TRUE AND RecordType.DeveloperName = 'ICTSupport' ALL ROWS];
You may include as many fields as you want.