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
Nikvm257Nikvm257 

how to get id of contact from account level

Hello Guys ,

 

I am using the stad controllr of account on my vforce.

I want to access/display  account's contact's ID 

 

sO I tried <apex:outputLabel value="{!account.contact.id}"/>

 

I got an error invalid field contact for SObject Account.

 

Let me know how to do that 

 

Thanks is advance!

 

-Nikhil 

Best Answer chosen by Admin (Salesforce Developers) 
Nikvm257Nikvm257
<apex:pageBlock title="My Account Contacts"> 
    <apex:pageBlockTable value="{! account.contacts}" var="item">
      
      <apex:column value="{!item.Name}"/> 
     
      <apex:column headerValue="Action">    
         <apex:outputLink value="/{!item.id}" > Create Opportunity </apex:outputLink>
      </apex:column>
      
    </apex:pageBlockTable> 
</apex:pageBlock>