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
Puja Patil 13Puja Patil 13 

show account and related contacts on same VFpage

I have to print the info or data of account object and related contact info of that account on visualforce page... how can i do that...?
 
Best Answer chosen by Puja Patil 13
Dutta SouravDutta Sourav
Hi Puja,

Try This:
<apex:page standardController="Account" recordSetVar="accs">
	<apex:form >
		<table>
			<apex:repeat value="{!accs}" var="acc">
				<tr>
						<td> <apex:outputText value="{!acc.Name}"/></td>
					<apex:repeat value="{!acc.Contacts}" var="cont">
						<td><apex:outputText value="{!cont.Name}"/></td>
      				</apex:repeat>
				</tr>
			</apex:repeat>
		</table>
	</apex:form>
</apex:page>
Hope this helps!

Best Regards,
Sourav.

All Answers

Dutta SouravDutta Sourav
Hi Puja,

Try This:
<apex:page standardController="Account" recordSetVar="accs">
	<apex:form >
		<table>
			<apex:repeat value="{!accs}" var="acc">
				<tr>
						<td> <apex:outputText value="{!acc.Name}"/></td>
					<apex:repeat value="{!acc.Contacts}" var="cont">
						<td><apex:outputText value="{!cont.Name}"/></td>
      				</apex:repeat>
				</tr>
			</apex:repeat>
		</table>
	</apex:form>
</apex:page>
Hope this helps!

Best Regards,
Sourav.
This was selected as the best answer
Puja Patil 13Puja Patil 13
i dont want all account..
only for one account and related contacts of same
Puja Patil 13Puja Patil 13
Hi Sourav,

I want to link that VF page to custom button of account record. so i want perticular account and there related contact list