0 votes
1 view
in Salesforce by (11.3k points)

From the Salesforce documentation:

"Because there are applications like Access which do not recognize that 50130000000014c is a different ID from 50130000000014C, an 18-digit, case-safe version of the ID is returned by all API calls. The 18 character IDs have been formed by adding a suffix to each ID in the Force.com API. 18-character IDs can be safely compared for uniqueness by case-insensitive applications, and can be used in all API calls when creating, editing, or deleting data."Yet, from my Visualforce page:

{!Account.Id}

returns the 15-digit ID rather than the 18 digit ID.

Is there a different parameter/property I can use to give me the 18-char ID? Why is it when the docs clearly say all API calls return the 18-char ID, Account.Id gives me the 15-char ID?

1 Answer

0 votes
by (28.6k points)
edited by
I consider that there are a couple of reasons here. Visualforce is not considered an "API call" or at least not in the traditional sense. The case-insensitive 18 digit ids were added to help with data integration with systems like Access, but if you are interacting with other websites via URLs and query parameters, they are already case sensitive, so the 15 digits case-sensitive id should work fine for you. To convert 18 to 15, just strip off the last 3 chars. All inbound requests into SFDC (UI, API, VF, Apex, etc) accept both 15 and 18 char ids.
...