Salesforce Fact #779 | Error during emptyRecycleBin()

While using the Database.emptyRecycleBin() method, if there are cascade delete relationship between records then only the top level record id needs to be specified.

For example, if there are account and related contact records which are to be hard deleted, only the account record id needs to be specified. Otherwise, if both the account and contact record ids are specified, we get the error: 'Invalid record id; no recycle bin entry found'.

Reference: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_database.htm#apex_System_Database_emptyRecycleBin

Attached are the screenshots.




Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow