1

I know that Id records in an object are created randomly and are not repeated.

My question is: this repetition does not occur because the records exist, but what if one or more records are deleted? Can that deleted Id be generated again at some point?

For example, i have three records with the following Id's:

Id1: 001e000001asWtQAAU

Id2: 001e000001asWtQBBU

Id3: 001e000001asWtQCCU

If I delete the record with "Id3", do the next records created have a chance to be created with that same Id?

6

They are created consecutively, not randomly, per salesforce instance (e.g. na3 will have its own pool of numbers). Within a single org, the ID values will never be duplicated, and even all throughout production, no Id will ever appear twice (because each ID also includes a "pod Id" to identify the origin of an Id). Cloning an org (e.g. a Sandbox) will result in identical Id values in both orgs, but that's the only time a single ID will be used more than once.

Salesforce does not currently recycle its Id values, so no org in production will ever have the same record Id for two different records, even if records are deleted and created later. Salesforce is currently using only a few percent of the available Id values, so they wouldn't need to worry about expanding or recycling ID values any time this century.

Note that your example ID values are incorrect; the last three characters are derived from the first 15 characters. See What are Salesforce ID's composed of? for more information on the internal structure of Id values.

2
  • Hello @sfdcfox! These id's I created by hand, so they don't really exist. So even if deleted, the next records will not have a chance to be created with the deleted record's Id. Right? – Diego Edargo Pessoa Apr 15 at 17:44
  • @DiegoEdargoPessoa Correct. – sfdcfox Apr 15 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.