I'm reading in many places that restored records should be given new ids, however I did some testing through the UI and confirmed that new ids aren't being given.

I wrote down the id of an account before deleting it. I then went to the recycle bin and restored the account. I compared both ids and they are the same.

I also tried this through code and got the same outcome.

Can someone clear this up?

1 Answer 1


Whoever wrote whatever document you read that new ID values are generated when restoring records is incorrect. A record is assigned an ID once, on creation, and will never change, no matter what happens to the record.

A record's ID is locally unique within the org, and globally unique within the instance, with the exception being that record IDs copied to a Sandbox from Production may exist in multiple orgs, but will still be unique within that org.

When that record is "soft deleted", its IsDeleted flag is set to true, and any child records with cascade deletions are also deleted. The record doesn't lose its ID. If the record is subsequently undeleted, the IsDeleted is set back to false, and any cascade deleted items are also restored. The ID doesn't change.

If the record is permanently deleted ("hard delete"), that record ID is removed from Salesforce entirely and will never be used again. In other words, if you're comparing records in an org with an external data source, and you find a matching ID, you can guarantee you're looking at the same record.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .