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
Adam RycroftAdam Rycroft 

visualforce page with extensions?

I'm struggling to understand this concept.

We have a custom object (Intake__c) that is the master in relationships with other objects (Income__c, Non_Cash_Benefits__c etc.)

I need to be able to create a custom button from an Intake Record that can create a pdf of the Intake Record as well as display fields from records within the related list. Just showing the related list in the pdf does not suffice which is what he currently have.

What is the easiest way to do this? Would I need to create extensions for all the related objects where the id on the Intake Record is the same as the ID on the child records and add them to the standard controller for Intake__c? Then in the VF page layout use an apex:repeat value to displays fields from the multiple records associated to the intake?

If so, could someone help me out with what the basic code for this would look like?

Thanks,

Adam
Best Answer chosen by Adam Rycroft
Zhen Yueh LeanZhen Yueh Lean
Hi Adam,

You can do something like this if you want to display the child fields:
 
<apex:page standardController="Account">
    <apex:pageBlock >
    You're looking at some related lists for {!account.name}:
    </apex:pageBlock>
    
    <apex:repeat value="{!Account.Opportunities}" var="opp">
        <apex:outputField value="{!opp.Name}"/>
        <apex:outputField value="{!opp.Amount}"/>        
    </apex:repeat>
</apex:page>

 

All Answers

Zhen Yueh LeanZhen Yueh Lean
Hi Adam,

You can do something like this if you want to display the child fields:
 
<apex:page standardController="Account">
    <apex:pageBlock >
    You're looking at some related lists for {!account.name}:
    </apex:pageBlock>
    
    <apex:repeat value="{!Account.Opportunities}" var="opp">
        <apex:outputField value="{!opp.Name}"/>
        <apex:outputField value="{!opp.Amount}"/>        
    </apex:repeat>
</apex:page>

 
This was selected as the best answer
Adam RycroftAdam Rycroft
THANK YOU. This is so much easier than how I was trying to do it.