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
anan 

15 and 18 digit versions of id field - which one to use?

According to salesforce documentation there are 15 and 18 digit versions of record ids. The documentation also recommends to use the 18 digit version.

 

In salesforce user interface the 15 digit version is usually shown but the 18 digit version usually seems to work too. 

 

Now I faced the problem when I am trying to create a link to the case creation and autopopulate the account lookup. So I am passing the account name and id as parameters. But if I use the 18-digit version for the account id I get the error message "Data not available for this view". The 15 digit version works fine here. Also for the contact lookup field the both versions are ok. So to clarify here are the links I am using:

 

This gives error: /500/e?cas4=AccountName&cas4_lkid=AccountId18Digits

This doesn't:  /500/e?cas4=AccountName&cas4_lkid=AccountId15Digits

 

I thought that inside salesforce both 15 and 18 digits versions could be used. Does anyone know if there is some reference where I could check when to use 18digit and when to use 15 digit version?

 

werewolfwerewolf
In general they are interchangeable.  The URL format is not a supported API though so there isn't any docs on how to format your IDs for that -- just go with whatever works there.