+ Start a Discussion
d3developerd3developer 

Get Id from Standard Object in Visualforce Page

So I think this may also be a n00b question but I can't seem to figure out how to display the id of a standard object in a Visualforce page.

 

 

All I want is something like this:

 

 

<apex:page standardController="Contact">

   {!object.id}

</apex:page>

 

Any ideas? I know I could use a custom controller as an extension but would prefer not to.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert

I think it is {!Contact.Id}

 

 

<apex:page standardController="Contact">

   {!Contact.id}

</apex:page>

 

 

 

All Answers

aalbertaalbert

I think it is {!Contact.Id}

 

 

<apex:page standardController="Contact">

   {!Contact.id}

</apex:page>

 

 

 

This was selected as the best answer
krishnagkrishnag

i dont think object dont have ids the records of the object have ids.

d3developerd3developer

Thanks aalbert, works like a charm.

Mukesh Yadav 3Mukesh Yadav 3
I can find the id , name etc and total value from the standard object using this code.

<apex:page standardController="contact" recordSetVar="contact">
     <apex:pageBlock title="The id of the contact Standard object">
        <apex:pageBlockTable value="{!contact}" var="a">
            <apex:column value="{!a.id}"/>
            <apex:column value="{!a.name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

If u don't use the recordSetVar then data is not showing because this contains all data into record set varible after that showing on the visual force page.
Thanks
Mukesh