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
Bob_zBob_z 

visualforce pdf I only want to show selected relate records from an Account object

I have a button on the account object, when a user clicks on it, it launches a visuaforce page as a PDF document. I am trying to figure out how do I get this docuemnt to be created, but i want the users to be able to select the related records then launch the visualforce page with the selected records shown to download as a document. 

I'm not sure how this can be accomplished, Apex, Flow, Process Builder, etc.  Any help on this would be greatly appreciated.

Visualforce Page:
 
<apex:page standardcontroller="Account" renderas="pdf" extensions="AccountExtensionController" standardstylesheets="false" showheader="false" applyhtmltag="false">
<form >
<html xmlns="http://www.w3.org/1999/xhtml">
    <body style="color:#000000;border-style:solid; border-width:0px; width:85%; text-align:center">
    </body>

    <table align="center" width="85%" style="font-family: Arial, Helvetica, sans-serif;text-align:left;"
               cellpadding="2">
            
            <tr>
                <td colspan="4" style="font-size:12px; font-weight: normal">
                </td>
            </tr>
            
            <tr>
                <td colspan="4" style="font-weight:bold ; border-style:solid; border-width:1px;
                border-color:#000000;padding:3px;text-align:center;background-color:#B4C6E7">
                    SERVICE PARTNER DETAILS
                </td>
            </tr>

    </table>
            
    <table align="center" width="85%" style="font-family: Arial, Helvetica, sans-serif; text-align:left;"
               cellpadding="2">
            <tr>
                <td width="50%" align="left" style="color: #000000;text-align:left; border-left-style: solid; border-left-width: thin;
                border-left-color: #ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px;padding-top:10px">
                    <b>Company</b> {!Account.Name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

                <td width="50%" align="right" style="color: #000000;text-align:left; border-right-style: solid; border-right-width: thin;
                border-right-color:#ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px;padding-top:10px">
                    <b>Office Phone</b> {!Account.Phone}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td width="25%" align="left" style="color: #000000;text-align:left; border-left-style: solid; border-left-width: thin;
                border-left-color: #ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px">
                    <b>Contact</b> {!Account.Primary_Field_POC__r.FirstName} {!Account.Primary_Field_POC__r.LastName} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

                <td width="25%" align="left" style="color: #000000;text-align:left; border-right-style: solid; border-right-width: thin;
                border-right-color:  #ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px"><b>Cell Phone</b> {!Account.Secondary_Phone__c}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>
            <tr>
                <td width="25%" align="left" style="color: #000000;text-align:left; border-left-style: solid; border-left-width: thin;
                border-left-color: #ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px">
                    <b>Street Address</b><br/> {!Account.BillingStreet}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

                <td width="25%" align="left" style="color: #000000;text-align:left; border-right-style: solid; border-right-width: thin;
                border-right-color:#ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px"><b>Fax</b> {!Account.Fax}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>
            
            <tr>
                <td width="25%" align="left" style="color: #000000;text-align:left; border-left-style: solid; border-left-width: thin;
                border-left-color: #ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px">
                    <b>City, St. Zip</b><br/> {!Account.BillingCity}, {!Account.BillingState} {!Account.BillingPostalCode}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td width="25%" align="left" style="color: #000000;text-align:left; border-right-style: solid; border-right-width: thin;
                border-right-color: #ffffff;font-style:normal; font-weight:normal;font-size:12px;padding-bottom:10px"><b>Email</b> {!Account.Primary_Field_POC__r.Email}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="4" style="font-weight:bold ; border-style: solid; border-width:1px;
                border-color: #000000;padding:3px;padding:3px;text-align:center;background-color:#B4C6E7">PER PUSH FEE SERVICE AGREEMENT</td>
            </tr>
    </table>
            
    <table align="center" width="85%" style="font-family: Arial, Helvetica, sans-serif;  text-align:left;"
               cellpadding="4">
          
            <tr>
               
            <td width="50%" align="left" style="color: #000000;text-align:center; border-right-style: solid; border-right-width: thin;
                border-right-color: #ffffff;font-style:normal; font-weight:normal;font-size:12px;padding:3px">Per Push Fees: Includes all fees necessary to complete the services described in the scope of work for the event duration.  Hourly pricing applies only to extra services.
            </td>
            </tr>
    </table>
 
    <table align="center" width="85%" style="font-family: Arial, Helvetica, sans-serif;   text-align:center;"
               cellpadding="2">
            
            <tr>
                <td colspan="4" style="font-size:12px; font-weight: normal">
                </td>
            </tr>
            
            <tr>
                <td colspan="4" style="font-weight:bold ; border-style: solid; border-width:1px;
                border-color:#000000;padding:3px;background-color:#B4C6E7;">
                  Service Locations and Fees
                </td>
            </tr>
        <tr><td></td></tr>
    </table>
   
    <table align="center" width="85%" style="font-family: Arial, Helvetica, sans-serif; text-align:left;"
               cellpadding="0">
              
            <apex:repeat var="sd" value="{!bidsList}">
            


                    <tr>
                        <th style="text-align:center;background-color:#d9d9d9;border-bottom-style:solid;border-bottom-width:1px;border-top-width:1px; border-top-style:solid">Site Name</th>
                        <th style="text-align:center;background-color:#d9d9d9;border-bottom-style:solid;border-bottom-width:1px;border-top-width:1px; border-top-style:solid">Service Period</th>
                        <th style="text-align:center;background-color:#d9d9d9;border-bottom-style:solid;border-bottom-width:1px;border-top-width:1px;border-top-style:solid">Address</th>
                    </tr>
                   
                   <tr>

                        <td style="font-weight:bold ; border-bottom-style:solid; border-bottom-width:1px;
                            color:#000000;padding:3px;text-align:center;background-color:#f2f2f2" > {!sd.Customer__r.Name }</td>
                        <td style="font-weight:bold ; border-bottom-style:solid; border-bottom-width:1px;
                            color:#000000;padding:3px;text-align:center;background-color:#f2f2f2" ><apex:outputText value="{0, date, MMMM d','  yyyy}">
                        <apex:param value="{!sd.Customer__r.Contract_Start_Date__c}" /> </apex:outputText> - <apex:outputText value="{0, date, MMMM d','  yyyy}">
                        <apex:param value="{!sd.Customer__r.Contract_End_Date__c}" /> 
</apex:outputText> </td>
                        <td style="font-weight:bold ; border-bottom-style:solid; border-bottom-width:1px;
                            color:#000000;padding:3px;text-align:center;background-color:#f2f2f2" >{!sd.Site__r.BillingStreet}<br/>{!sd.Site__r.BillingCity}, {!sd.Site__r.BillingState} {!sd.Site__r.BillingPostalCode} </td></tr>

                <apex:repeat var="et" value="{!bidsMap[sd.Name] }"  >
    
                   <tr>
                       <th style="text-align:center;background-color:#d9d9d9;border-bottom-style:solid;border-bottom-width:1px;border-top-width:0px; border-top-style:solid">Service Type</th>
                       <th style="text-align:center;background-color:#d9d9d9;border-bottom-style:solid;border-bottom-width:1px;border-top-width:0px; border-top-style:solid">Service Desciption</th>
                       <th style="text-align:center;background-color:#d9d9d9;border-bottom-style:solid;border-bottom-width:1px;border-top-width:0px; border-top-style:solid">Pricing Schedule</th>
                   
                   </tr>

                   <tr>
                        <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;text-align:center" class="ctr"> {!et.Bid_Name__r.Service_Type__c}</td>
                        <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;text-align:center;text-align:center" class="ctr">{!et.Scope__c} <br/>  {!et.Increment__c}</td>
                        <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;text-align:center;text-align:center" class="ctr"> ${!et.Price__c}</td>
                   </tr>

                </apex:repeat>
                
            </apex:repeat>
           </table>
        
    </html>

</form>


</apex:page>