1

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:column>
                      <apex:facet name="header">Payment Amount</apex:facet>
                      {!ps.Payment_Amount__c}</Apex:column>
                  <Apex:column>
                      <apex:facet name="header">Payment Type</apex:facet>              
                      {!ps.Payment_Type__c}</Apex:column>
                  <Apex:column>
                      <apex:facet name="header">Payment Reason Detail</apex:facet>              
                      {!ps.Payment_Reason_Detail__c}</Apex:column>
                  <Apex:column>
                      <apex:facet name="header">Payment Status</apex:facet>
                      {!ps.Payment_Status__c}</Apex:column>
              </Apex:pageBlockTable>
          </apex:pageBlock>
</apex:page>

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 SCHEDULE 1----------

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

PAYMENT SCHEDULE 2----------

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

etc....

Would appreciate any guidance!

Thanks, Lexie

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

0

You must log in to answer this question.

Browse other questions tagged .