function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nbeekmannbeekman 

Salesforce Unique ID

Hello,

 

I'm a bit concerned, the Apex Explorer tells me that the Unique ID length is 18 but when you run reports pulling this number its 15.  All URL's say its 18.  We are in the process of automating Salesforce with SAP in which SAP uses a 15 Character Unique Identifier.

 

So my question is, does it use a 15 or 18 character ID? 

Best Answer chosen by Admin (Salesforce Developers) 
werewolfwerewolf

It's both.  The real ID is just 15 characters.  The additional 3 characters are an error checking and correcting code.  They can safely be omitted.  They're there because Salesforce.com IDs are case sensitive, but every now and then browsers mess up the case, making them all uppercase or all lowercase; 0033000000UIHCr is a different ID than 0033000000UIHCR.  So this 3-letter code at the end checks the case and corrects it if it's wrong.

 

As long as you're storing the IDs in such a way that you're not mucking with the case in any way, then just storing the 15 characters will be fine.

All Answers

werewolfwerewolf

It's both.  The real ID is just 15 characters.  The additional 3 characters are an error checking and correcting code.  They can safely be omitted.  They're there because Salesforce.com IDs are case sensitive, but every now and then browsers mess up the case, making them all uppercase or all lowercase; 0033000000UIHCr is a different ID than 0033000000UIHCR.  So this 3-letter code at the end checks the case and corrects it if it's wrong.

 

As long as you're storing the IDs in such a way that you're not mucking with the case in any way, then just storing the 15 characters will be fine.

This was selected as the best answer
nbeekmannbeekman
Thank you for the fast response, now to coding :)
SuperfellSuperfell

Importantly the 15 char Ids can have different values, where character case is the only difference (e.g. oooA and oooa are different ids), the equivalent 18 char version always differs by more than just character case. This is important because many data tools default to case insensitivity (many releases of sql server for example used case insensitive string colation as their default).

 

Reports are meant as an end user feature, not an integration feature, hence they don't use the 18 char versions. (There are good reasons to change this, but its difficult now without breaking lots of people, but there is an idea-exchange idea for this if you want to vote on it).