Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hi
You need to use standardlistcontroller for that
<apex:page standardController="account" recordSetVar="accounts" tabstyle="account" sidebar="false"> <apex:pageBlock > <apex:form ><apex:dataList value="{!accounts}" var="a"> <apex:pageblocksection title="Contacts for account {!a.name}" > <apex:repeat value="{!a.contacts}" var="c"> <apex:inputField label="Contact name" value="{!c.name}"/><br/> </apex:repeat></apex:pageblocksection> </apex:dataList> </apex:form> </apex:pageBlock> </apex:page>
Change the UI according to your requirement
Hi,
Try the below code snippet as reference:
<apex:page standardController="Account" >
<apex:pageBlock >
<apex:pageBlockTable value="{!account.contacts}" var="contact">
<apex:column value="{!contact.name}"/>
<apex:column value="{!contact.email}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
HI,
you can fetch contacts associated with a account using their relationship (master-child).
<apex:page standardController="account" > <apex:form > <apex:pageBlock title="Contact details for account" > <apex:pageBlockTable value="{!account.contacts}" var="con"> <apex:column value="{!con.name}"/> <apex:column breakBefore="{!con.id}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Make sure you enter account id in the browser.
for ex
https://c.ap1.visual.force.com/apex/contactdetails?id=00190000003OHIS
where 00190000003OHIS is the id of account.
But i've to get the Multiple record's of account and its contacts
You need to use standardlistcontroller for that
Change the UI according to your requirement
All Answers
Hi,
Try the below code snippet as reference:
<apex:page standardController="Account" >
<apex:pageBlock >
<apex:pageBlockTable value="{!account.contacts}" var="contact">
<apex:column value="{!contact.name}"/>
<apex:column value="{!contact.email}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
HI,
you can fetch contacts associated with a account using their relationship (master-child).
Make sure you enter account id in the browser.
for ex
https://c.ap1.visual.force.com/apex/contactdetails?id=00190000003OHIS
where 00190000003OHIS is the id of account.
But i've to get the Multiple record's of account and its contacts
But i've to get the Multiple record's of account and its contacts
You need to use standardlistcontroller for that
Change the UI according to your requirement