A while ago I built a custom controller before I knew how the platform worked completely (not that I do now, but I digress). Anyway, the controller was supplying the 18-character ID of the object that was being accessed. Now, I know I can just pull the ID out of the standard controller and dump my custom controller entirely, but it's only supplying the 15-character ID. How can I access the 18-character ID without the custom controller in the Visualforce page? Is there a formula I can use? Or does the standard controller provide a property that is the 18-character ID?

Here's how my current Visualforce page is like:

<apex:page standardController="Opportunity" extensions="vNextAttachmentsController">
    <apex:iframe height="200" scrolling="true" src="https://{host}/{!$User.Id}/Attachments/Opportunity/{!Id}" />

1 Answer 1


you can use the CASESAFEID function to covert from 15 to 18 char ids..

but i believe visualforce / standard controller by default will give you the 18 char ids..

in the below code you will get the 18 char id for both the options

<apex:page standardController="Account" >



  • 3
    Perfect! It turns out that {!Id} by itself returns the 15-character ID, but {!OBJECT.Id} returns the 18-character ID I need. That's where I was having issues because I never qualified the lookup with the object name. Thanks for the help!
    – Gup3rSuR4c
    May 5, 2015 at 3:09

You must log in to answer this question.

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