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
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communitySupose 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">
{!c.name}
</apex:repeat>
</apex:page>
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}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:page>
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" />
</apex:page>