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
sparrowbradsparrowbrad 

Cross Object Reference on VF Email Template Page

Looking to get contract help with the below - I'm not a developer, let me know if anyone is interesting in the below project based work.

Objects Referenced
Opportunity
Opportunity Line Items
Payments (custom object that is detail to Opportunity)
 
I’m looking to generate a VisualForce email template so we can send invoices to our clients. The invoice will be generated from the Payment record. 
 
On the invoice, I will display Payment fields (not an issue). But I also want to display the Opportunity Line Items from the related Opportunity record. This is where I’m running into an issue.
 
What I’ve tried is using my VisualForce template on payment object and placing an iframe (the iframe is another VisualForce page that displays the necessary Opportunity Line Items). This worked, however, I need the attachment in the Invoice email to be rendered as a PDF. Iframes are not supported in PDFs.
 
This is where I realized I need a custom controller and DEV help.
Evan KennedyEvan Kennedy
I don't think iframes are going to really be viable in an email template.

What you need to do in this situation is write a custom visualforce component that displays that loops through and displays the line items, and then call this component from the email template.