You need to sign in to do that
Don't have an account?
Denis O'Leary
Render Page As PDF
Hi,
I'm trying to view a custom salesforce object as a PDF. I've an object that has object Line Items (Not too dissimalar to Opportunity -> Opportunity Products set up) I want to print the custom object with the line items attached but can't seem to see how to do this.
This works on the Opportunity object for printing the list of opporunity products on to a table->
<apex:repeat var="lineitem" value="{!opportunity.OpportunityLineItems}">
but when I try this on my custom object <apex:repeat var="lineitem" value="{!Estimate__c.Estimate_Product_Line_Item__c}">
I get an error "Invalid Field Estimate_Product_Line_Item__c for SObject Estimate__c"
There is a master detail relationship between my objects Estimate and Estimate products
Can any one help with something that might get me off the ground on this?
I'm trying to view a custom salesforce object as a PDF. I've an object that has object Line Items (Not too dissimalar to Opportunity -> Opportunity Products set up) I want to print the custom object with the line items attached but can't seem to see how to do this.
This works on the Opportunity object for printing the list of opporunity products on to a table->
<apex:repeat var="lineitem" value="{!opportunity.OpportunityLineItems}">
but when I try this on my custom object <apex:repeat var="lineitem" value="{!Estimate__c.Estimate_Product_Line_Item__c}">
I get an error "Invalid Field Estimate_Product_Line_Item__c for SObject Estimate__c"
There is a master detail relationship between my objects Estimate and Estimate products
Can any one help with something that might get me off the ground on this?
All Answers
Have you tried <apex:repeat var="lineitem" value="{!Estimate__r.Estimate_Product_Line_Item__c}"> ??
Diego
ok... and this one (I got the idea from https://developer.salesforce.com/forums/ForumsMain?id=906F000000097MqIAI)
<apex:repeat var="lineitem" value="{!Estimate__c.Estimate_Product_Line_Item__r}">
If it doesn´t work, could you share your code (or at least the most representative parts?
<table class="tables" cellpadding="6" cellspacing="0" width="100%" styleclass="subheader">
<tr class="subheader"><td>Description</td>
<td align="right">Quantity</td>
<td align="right">Make/Model</td>
<td align="center">Root</td>
<td align="right">Price</td></tr>
<tr>
</tr>
<apex:repeat var="lineitem" value="{!Estimate_Product_line_Items}">
<tr>
<td align="left" width="20%" class="subheader">{!lineitem.Comments__c}</td>
<td align="center" class="subheader">{!lineitem.Quantity__c}</td>
<td align="right" class="subheader"><apex:outputfield value="{!lineitem.Estimate_Product__c}" /></td>
<td align="right" class="subheader"><apex:outputfield value="{!lineitem.Root__c}" /></td>
<td align="right" class="subheader"><apex:outputfield value="{!lineitem.Price__c}" /></td>
</tr>
</apex:repeat>
<tr><td class="invisiblecell"></td><td colspan="3" class="subheader">Order Total</td><td class="subtext" align="right">
<apex:outputfield value="{!opportunity.Total_Sales_INDincl__c}"/></td></tr>
</table>
</apex:page>
<apex:page standardController="Estimate_Product_line_Item__c" renderAs="pdf">
<table class="tables" cellpadding="6" cellspacing="0" width="100%" styleclass="subheader">
<tr class="subheader"><td>Description</td>
<td align="right">Quantity</td>
<td align="right">Make/Model</td>
<td align="center">Root</td>
<td align="right">Price</td></tr>
<tr>
</tr>
<apex:repeat var="lineitem" value="{!Estimate_Product_line_Item__c}">
<tr>
<td align="left" width="20%" class="subheader">{!lineitem.Comments__c}</td>
<td align="center" class="subheader">{!lineitem.Quantity__c}</td>
<td align="right" class="subheader"><apex:outputfield value="{!lineitem.Estimate_Product__c}" /></td>
<td align="right" class="subheader"><apex:outputfield value="{!lineitem.Root__c}" /></td>
<td align="right" class="subheader"><apex:outputfield value="{!lineitem.Price__c}" /></td>
</tr>
</apex:repeat>
<tr><td class="invisiblecell"></td><td colspan="3" class="subheader">Order Total</td><td class="subtext" align="right">
<apex:outputfield value="{!Estimate_Product_line_Item__r.Opportunity.Total_Sales_INDincl__c}"/></td></tr>
</table>
</apex:page>
I think it should work for what you are requesting, doesn't it?