I’m trying to delete certain records from the recycle bin.
I am querying the Account records like as:
Map<Id,Account>accMap = new Map<Id,Account>([Select id.name from Account where Type='xyz value' ALL ROWS]); List<ID> accIds = new List<Id>(accmap.keyset());// Getting correct Ids Database.emptyRecycleBin(accIds); //my account records are successfully deleted from recycle bin
However if i do the same query again then it again showing the same account records.
Can anyone help me why these records are coming out by SOQL but has already been removed from recycle bin.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
This is because the records have not been hard deleted from the recycle bin. Salesforce runs a process on a scheduled basis that physically deletes records that have been deleted from the recycle bin, if that process has not run yet, you will still see the records there.
A fuller description of the behavior of emptyRecycleBin can be found here.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0