ENTITY_IS_DELETED in Salesforce: what it means and how to fix it

Short answer: ENTITY_IS_DELETED means the record ID in your request belongs to a record that has already been deleted. The ID is well formed and once existed, but the record now sits in the Recycle Bin or is gone entirely, so Salesforce can't update it, delete it again, or let another record point at it.

Deleting a record in Salesforce usually moves it to the Recycle Bin rather than erasing it straight away. Its ID stays reserved and can be undeleted for a while, but the record is no longer usable. Any API call that tries to update it, delete it again or reference it from another record fails with:

ENTITY_IS_DELETED: entity is deleted

The message is short and doesn't say who deleted the record or when. Integrations hit it most often because they cache IDs.

Why it happens

  • Stale IDs in an integration. A sync or middleware layer stored an ID, someone deleted the record in Salesforce, and the next update uses the old ID.
  • Cascade deletes. Deleting a master record removes its detail records along with it. A later delete or update for those details finds them already gone.
  • Merges. Merging records deletes the losing records. Their IDs stop working immediately.
  • Delete jobs running twice. A retried delete batch, or two processes cleaning up the same records, means the second attempt targets rows the first already removed.
  • References to deleted parents. Setting a lookup to the ID of a record in the Recycle Bin fails because the parent no longer counts as live.
  • Automation. A trigger or flow deletes a related record during the same operation that another step then tries to touch.

How to fix it

  1. Check the Recycle Bin. Query with queryAll and IsDeleted = true to confirm the record was deleted, and undelete it if it should still exist.
  2. Refresh cached IDs. Re-read IDs from Salesforce before updating, or match on an External ID so the integration finds the live record.
  3. Delete children before parents. Ordering deletes from the bottom of the hierarchy up avoids racing a cascade.
  4. Treat it as done on deletes. When the goal was removal, record this outcome as success rather than retrying.
  5. Follow merges. After a merge, repoint references to the surviving master record.

How Syntharil handles it

Syntharil classifies ENTITY_IS_DELETED as an org state error. Delta replication runs can propagate source deletions: Syntharil queries the source's Recycle Bin for records deleted since the last run, maps them to the target rows it created itself, and deletes those in reverse dependency order, children before parents. An ENTITY_IS_DELETED result in that pass counts as a successful delete, because a cascade in the target got there first. Other delete failures are reported per object with the source ID, target ID and Salesforce's message, and the optional Recycle Bin purge skips them. Archive purges tolerate the error the same way. When a delta upsert finds no live target record, Salesforce creates one and Syntharil counts it as an insert.

FAQ

Can I treat ENTITY_IS_DELETED as success when deleting?

Usually yes. If your goal was to delete the record and Salesforce says it's already deleted, the end state is what you wanted. Treat it as a failure only if you expected the record to still exist.

Why does deleting a child return ENTITY_IS_DELETED?

Deleting a master record also deletes its detail records. If you delete the master first and then send the details, those details are already gone and come back with this error.

How do I bring back a record that returns ENTITY_IS_DELETED?

If it's still in the Recycle Bin, undelete it from the Recycle Bin page or with the API's undelete call, and it returns with the same ID. Once permanently deleted, it can't be restored.

Can I query records that return ENTITY_IS_DELETED?

Normal SOQL queries skip deleted records. The queryAll endpoint, or ALL ROWS in Apex, includes rows in the Recycle Bin, and IsDeleted = true filters to just those.

Why does a merge cause ENTITY_IS_DELETED?

Merging Accounts, Contacts or Leads keeps one master record and deletes the others. Any process still holding the IDs of the merged-away records gets this error when it uses them.

All Salesforce errors →

Try Syntharil free