You need to sign in to do that
Don't have an account?
is it possible to use apex:relatedList to display a Parent Object's related items?
I have a custom object (Letter_Of_Agreement) that has an Account record as it's master.
I was hoping to be able to leverage the existing related list mechanism to display the Account's contacts on a visualforce page (the page is using the LOA controller).
Is it possible to reference the parent relationship of an object in a related list in some way? i.e. <apex:relatedList list="Account__r.Contacts" />
No matter the variation I use, I get an error "List attribute parent name 'account/account__r/etc' is an invalid field name for entity LOA"
Should I just recreate the related list functionality & look with a custom query and some visualforce?
Check the subject attribute of the relatedList tag. Using that, you would be able to achieve what you want. Heres an example where I display the Contacts related list of Account from Opportunities standard controller
<apex:page standardController="Opportunity"> <apex:detail relatedList="false"/> <apex:relatedList list="Contacts" subject="{!Opportunity.AccountId}"/> </apex:page>
All Answers
Check the subject attribute of the relatedList tag. Using that, you would be able to achieve what you want. Heres an example where I display the Contacts related list of Account from Opportunities standard controller
<apex:page standardController="Opportunity"> <apex:detail relatedList="false"/> <apex:relatedList list="Contacts" subject="{!Opportunity.AccountId}"/> </apex:page>
Rajesh,
thank you very much for pointing out what should have been obvious! I thought I had checked the Standard Component docs already.
Next time I will 'look with my eyes and not my mouth.' Or keyboard, in this case. :)
AJ
I have created a VF page. It has 3 fields. Prodcut Name , Product Family, Product description.
PRODUCT NAME is a lookup field to an object PRODUCT INFORMATION.
whenever Product Name is chosen it should auto populate Product Family and Product Description
Here is my code
<apex:page standardController="SMART_Program__c" Extensions="SMARTProgramParticipatingSKUs" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Define Participating Products for Program: {!SMART_Program__c.Name}" columns="2">
<apex:outputField value="{!SMART_Program__c.Program_Start_Date__c}"/>
<apex:outputField value="{!SMART_Program__c.LastModifiedDate}"/>
<apex:outputField value="{!SMART_Program__c.Program_End_Date__c}"/>
<apex:outputField value="{!SMART_Program__c.Desired_Forecasted_Revenue__c}"/>
<apex:commandButton style="align:center" action="{!back}" value="Back to Program"/>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:commandButton action="{!addrow}" value="Add Row"/>
<apex:pageBlockTable value="{!productList}" var="product">
<apex:column headerValue="SKU Description">
<apex:inputField value="{!product.SKU_Description__c}"/>
</apex:column>
<apex:column headerValue="Product Family">
<apex:outputField value="{!product.Product_Family__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>