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
Carissa CrittendenCarissa Crittenden 

Custom Related Lists on PDF VF

I'm trying to build a printable PDF for records of a Custom Object, as well as the related child objects (also custom objects). I found this thread http://boards.developerforce.com/t5/Visualforce-Development/Rendering-mutiple-records-with-related-lists/m-p/272751/highlight/false#M34985 but I'm not sure how to implement it. I'm still in the early stages of building, so everything is super basic right now.

Here's my VF
<apex:page standardController="Demo_Request__c" renderAs="pdf">
    <body>
        <div id="account-info">
            <apex:panelGrid columns="2" width="100%">
                Account:<apex:outputText value="{!Demo_Request__c.Account__r.Name}"/>
                Owner: <apex:outputField value="{!Demo_Request__c.Owner.Name}"/>
            </apex:panelGrid>
        </div>
        

    </body>
</apex:page>
I'm great with clicks - not so much with the code. I added this apex class in as an extension to my VF (along with modified code from the thread I linked above) and I got errors. Here's the class as I modified it - throwing an error on line 5 - guessing I plugged the wrong thing in to that last get.
public with sharing class DemoRequest {
    public Demo_Request__c oList{ get; set; }
    public DemoRequest ()
    {
        String demoRequestQueryId = (String[])ApexPages.currentPage().getParameters().get('demorequest');
        String soqlQuery = 'select id, Name from Demo_Request__c';
        oList= Database.query(soqlQuery);

    }
    
}

Not sure where I went wrong or what other information to provide. TIA.
Waqar Hussain SFWaqar Hussain SF
use the below code and on line below use the Child Relationship Name instead of Custom_relation__r. Go to child custom object and clicko n the lookup/master detail relation of the parent object and the copy Child Relationship Name and concatenate __r 
 
<apex:repeat var="c" value="{!Demo_Request__c.Custom_relation__r}">

<apex:page standardController="Demo_Request__c" renderAs="pdf">
   <body>
      <div id="account-info">
         <apex:panelGrid columns="2" width="100%">
            <h1>Account Information</h1>
            <br/>
            Account: <b>{!Demo_Request__c.Account__r.Name}</b> 
            <br/> 
            <h1>Related Records</h1>
            <table width="100%">
               <tr>
                  <th>Name</th>
               </tr>
               <apex:repeat var="c" value="{!Demo_Request__c.Custom_relation__r}">
                  <tr>
                     <td>{!c.Name}</td>
                  </tr>
               </apex:repeat>
            </table>
         </apex:panelGrid>
      </div>
   </body>
</apex:page>