Supose I have example: Junction object fields

Where I replace Employment_Website__c with the object Contact. How do I write a repeat without using a class. master datail is lookup


Use the relationship:

<apex:page standardController="Account">

    <apex:repeat value="{!Account.Contacts}" var="c">


If displaying all records for a given object, This works for Account(s) but when replacing with the Contact Object it does not display any records......(Not sure why, i am tired)

<apex:page standardController="Account" recordSetVar="accounts">
  <apex:pageblock >
    <apex:pageBlockTable value="{!accounts}" var="a"><apex:column value="   {!a.name}"/>
  • 1
    @AdrianLarson - yea, thanks, tired was thinking about having many accounts and contacts to display. Depends on the use but for this case you are right, only need the Account (single) – Eric Sep 24 '16 at 3:21

You can also use the <apex:relatedList> tag. You don't have as much control over which fields display (just whatever would show on the layout), but it's hard to beat for simplicity.

<apex:page standardController="Parent__c">
    <apex:relatedList list="Children__r" />
  • 1
    It's either the search layout or the tab layout for the object that controls which fields display when using apex:related list – gorav Sep 25 '16 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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