Hope we're all hanging in there.

I'm relatively new to vf (please bear with me). I'm attempting to create a PDF via visualforce from a custom object (Deal_Summary__c) and its 5 related objects (4 are child of Master-Detail and 1 is via a lookup).

I was able to get the data from the related objects to display using the standard controller. Payment Schedules (connected to custom object, Deal Summary via a lookup field) below:

<apex:page standardcontroller="Deal_Summary__c" renderAs="pdf" applyBodyTag="false">
<apex:pageBlock title="Payment Schedules">
              <Apex:pageBlockTable value="{!Deal_Summary__c.Payment_Schedule__r}" var="ps">
                      <apex:facet name="header">Payment Amount</apex:facet>
                      <apex:facet name="header">Payment Type</apex:facet>              
                      <apex:facet name="header">Payment Reason Detail</apex:facet>              
                      <apex:facet name="header">Payment Status</apex:facet>

However, my client is very particular about the layout of the PDF, and some of the related objects have like 20 fields that need to be displayed, which in this case would be columns which wouldn't fit on the page width-wise. So showing the child records using the method above isn't going to work.

Is there a way for me to retrieve the related list records one-by-one and display them in separate tables/sections in the PDF to allow for more flexible formatting? For example:


Payment Amount - $10          | Payment Status - To be Paid
Payment Frequency - Annual | Payment Type - Advance


Payment Amount - $40            | Payment Status - Paid
Payment Frequency - Monthly | Payment Type - Studio Budget


Would appreciate any guidance!

Thanks, Lexie

  • Update! I figured it out - will post the answer once I have it all flushed out. Commented Oct 8, 2021 at 16:33


You must log in to answer this question.

Browse other questions tagged .