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
naresh johnnaresh john 

Problem with Organization ID

HI Every body,

 

     I found Organization ID in 'Company Information menu, Its has 15 digits. But the problem is, I need to use this ID in a visualforce page, there its working with 18 digit ID only.

 

     salesforce is adding 3 more digits, after 15 digits. I found this 18 digit ID, "View Page Source"  option in the browser.

 

 

Why salesforce is adding 3 more digits to my Organization ID. How to find this 18 digit ID in the salesaforce.

 

Please help me.

 

Thanks,

Naresh.B

Imran MohammedImran Mohammed

There are two versions of every record ID in salesforce

 

  • 15 digit case-sensitive version which is referenced in the UI, 
  • 18 digit case-insensitive version which is referenced through the API. 

 

The last 3 digits of the 18 digit ID are a checksum of the capitalizations of the first 15 characters; this ID length was created as a workaround to legacy systems which were not compatible with case-sensitive IDs.  

The API will accept the 15 digit ID as input but will always return the 18 digit ID.

 

Hope this helps.

Pradeep_NavatarPradeep_Navatar

Salesforce IDs are of two types 15 digit case sensitive and 18 digit case insensitive. Just truncating the last three characters won't always work if you try to do an exact string comparison of the first 15 characters and the value in the company profile page under setup. The Salesforce API and its related features (outbound messaging being one of them) always return 18 character IDs, so I'd suggest using the entire 18 character ID. Use this syntax in VF page to get 18 digit Salesforce Org ID -       {!$Organization.Id}

Victor DeLimaVictor DeLima

You can also use Dataloader and extract the table Organization. That will contain one record and the ID field would be the 18-Digit OrgId. If you need it for VF pages then you should use the approach given by Pradeep and avoid having to do manual changes to those pages when sandboxes are created/refreshed.

 

We use the 18-Digit Id as a second level check within middleware to make sure that we don't process messages coming from a sandbox into our production ERP systems.