2

I have a record id: a4o110000005EWH

I know the object prefix is a4o.

I have about 200 of the a40* records in the database.

The 11th, 12th, 13th, 14th characters of the 18 digit ID seem to uniquely ID the records thus far. In other words there is only 1 record whose id both starts with a4o and ends with 5EWH. I know best practice is to reference 15 digit ids when working within salesforce and 18 digit ids when working with foreign systems but my question is not about using best practices. My question is for how long can I rely on this pattern of using the first 3 and 11-14th characters to uniquely ID a record? In other words at what point will the count of zeros (in id assignment) change from six zeros (000000) to something different (five zeros or something else)

https://help.salesforce.com/articleView?id=000004383&type=1

1 Answer 1

3

Most of what you need to know is documented in What are Salesforce ID's composed of?.

The short answer is that the characters are base 62 encoded. So the number of records encoded by X characters are:

  • 1 character = 62 (62^1) - 15th character
  • 2 characters = 3,844 (62^2) - 15th + 14th character
  • 3 characters = 238,328 (62^3) - 15th to 13th characters
  • 4 characters = 14,776,336 (62^4) - 15th to 12th characters
  • ...
  • 9 characters = 13,537,086,546,263,552 (62^9) - 15th to 7th characters

Before the 7th character is reserved for things like the key prefix and pod identifier.

Note, it probably is not a good idea to ignore the pod identifier on the ID. One day your org might be migrated to a different pod and ID's will start getting created with different pod identifiers.

1
  • 1
    Daniel, thank you for the note on pods and for showing your work in the answer. I appreciate the contributions that you make in the community too! Hope polo is going well. May 18, 2017 at 4:01

You must log in to answer this question.

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