Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to get the Id of an object in a Visualforce page without a controller extension?

share|improve this question
up vote 6 down vote accepted

You just need to put the object API name and .Id in a formula expression holder? such as:


which you can put anywhere in a Visualforce page?

share|improve this answer
Yeah, realized how obvious this answer was right after I posted, thanks for helping me through my not-yet-caffienated morning – greenstork Mar 18 '14 at 14:49
Well, as a concise question and answer pair, it will remain on google for future searchers to find at least! – Simon Lawrence Mar 18 '14 at 14:50

You can do this using the merge field syntax. For example if you are using the Opportunity standard controller you can use {!opportunity.Id} in your Visualforce page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.