ENTITY_IS_DELETED: meaning and how to fix it
Quick answer
ENTITY_IS_DELETED: The operation referenced a record that has been deleted (it may still be in the Recycle Bin). Start with: Confirm the record is deleted: query it with ALL ROWS in Apex, or check the Recycle Bin.
Typical message: ENTITY_IS_DELETED, entity is deleted
Cause
The operation referenced a record that has been deleted (it may still be in the Recycle Bin).
How to fix ENTITY_IS_DELETED
- Confirm the record is deleted: query it with ALL ROWS in Apex, or check the Recycle Bin.
- Restore it with undelete if it should exist, or remove the stale reference.
- Refresh cached IDs in integrations that hold on to old records.
List<Account> a = [SELECT Id FROM Account WHERE Id = :id ALL ROWS];
undelete a; Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.
Frequently asked questions
What does ENTITY_IS_DELETED mean in Salesforce?
The operation referenced a record that has been deleted (it may still be in the Recycle Bin).
How do I fix ENTITY_IS_DELETED?
1. Confirm the record is deleted: query it with ALL ROWS in Apex, or check the Recycle Bin. 2. Restore it with undelete if it should exist, or remove the stale reference. 3. Refresh cached IDs in integrations that hold on to old records.
More Data and DML errors
SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.