Skip to main content
Hello, 

I am trying create a visualforce email template where I can send a vendor a list of all orders sent during a given week. 

I am dealing with three objects here: 

The Vendor: Vendor__c (the parent object, my template is related to Vendor__c)

The Order: Order__c (child object of the Vendor, standard lookup relationship) 

Order Line Item: LineItem__c (A child objecy of the Order, no lookup relationship to the vendor) 

I am good pulling a filtered list of orders related to the vendor onto my template like so:

 

apex:repeat value="{!relatedTo.Order__r}" var="buyline">

<apex:outputPanel rendered="{!IF(buyline.Broadcast_Week__c = relatedTo.Send_Request__c, true, false)}">

<table>

<tr>

<td>{!buyline.Buy_Title__c}</td>

</tr>

 But I would like to go one level deeper and list each LineItem__c that is associaated with each order.  In my head (this clearly isn't right, but I think it shows intent) it would work like this: 

 

<tr>

<apex:repeat value="{!relatedTo.Order__r.LineItem__r}" var="days">

<td>line item details will go here</td>

</apex:repeat>

</tr>

</table>

</apex:outputPanel>

</apex:repeat>

so that the records related to each related record (boy that's a mouthful) could be listed. 

Is this even possible?

Thanks, 

John

 
3 件の回答
  1. 2015年10月21日 23:08

    so I am getting the error: 

    Error: Compile Error: Variable does not exist: relatedTo.Id at line 9 column 100

    when trying to compile my controller.  I have never written a controller for an email template before, only actual pages.  Do I need to reference the template in the controller somewhere?

    here is what I am trying to compile: 

     

    public class NetworkOrders{

    public List<Order__c> orders {get;set;}

    public NetworkOrders(){

    List<Order__c> orders = new List<Order__c>();

    orders = [Select Id, Name, (Select Id, Name from LineItems__r) from Order__c where Network__c = :relatedTo.Id];

    }

    }

    thank you so much for your help!

     
0/9000