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
3CMarketing3CMarketing 

Apex:Repeat in email template.

So - HELP!  I have a custom object (RFQ) that is a child object to the Opportunity object.  I'm building a visualforce email template that lists the RFQs associated with the Opportunity.  This is the version of the code I think is closest to being correct, but I'm not sure.

Things to note:
- I'm sure that the Child Relationship Name is RFQs (I've checked)
- I've tried the following options for value: {!RelatedTo.RFQs__r}, {!RelatedTo.RFQs__c}, {!RelatedTo.Opportunity.RFQs__r}, and {!RelatedTo.Opportunity.RFQs__c} and get some sort of Invalid Field Error
 
<messaging:emailTemplate subject="An RFQ Has Been Submitted" recipientType="User" relatedToType="Opportunity">

    <messaging:htmlEmailBody >
        <html>
            <body>
            <img src="https://c.cs91.content.force.com/servlet/servlet.FileDownload?file=0152F00000055mq" width="100" height="105"></img>
            <p>Dear {!recipient.name},</p>
            <p>Below are the open RFQs associated with the following Opportunity: {!relatedTo.name}.</p>
                 <p><strong><em>RFQs:</em></strong></p>
          <table border="0" >
            <tr > 
               <th>Action</th>
               <th>RFQ Name</th>
               <th>RFQ Record ID</th>
               <th>Date Requested</th>
               <th>Date Needed</th>
               <th>Sales Rep</th>
            </tr>
 <tr>
             <apex:repeat var="cx" value="{!RelatedTo.RFQ__r}">
             
                <td><a href="https://na57.salesforce.com/{!cx.id}">View</a> |  
                <a href="https://na57.salesforce.com/{!cx.id}/e">Edit</a></td>
                <td>{!cx.RFQs.name}</td>
                <td>{!cx.RFQs.Record_Id__c}</td>
                <td>{!cx.RFQs.Date_Requested__c}</td>
                <td>{!cx.RFQs.Date_Needed__c}</td>
                <td>{!cx.RFQs.SalesRep__c}</a></td>
  
            </apex:repeat> 
           </tr>              
          </table>
            <p/>
                <apex:outputLink value="impact://matthews/salesforce/forms/model%20admin">
                    View this opportunity in ImpactECS
                </apex:outputLink>

            </body>
        </html>
    </messaging:htmlEmailBody>

<messaging:plainTextEmailBody >
Congratulations!
This is your new Visualforce Email Template.
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

 
3CMarketing3CMarketing
<messaging:emailTemplate subject="An RFQ Has Been Submitted" recipientType="User" relatedToType="Opportunity">

    <messaging:htmlEmailBody >
        <html>
            <body>
            <img src="https://c.cs91.content.force.com/servlet/servlet.FileDownload?file=0152F00000055mq" width="100" height="105"></img>
            <p>Dear {!recipient.name},</p>
            <p>Below are the open RFQs associated with the following Opportunity: {!relatedTo.name}.</p>
                 <p><strong><em>RFQs:</em></strong></p>
          <table border="0" >
            <tr > 
               <th>Action</th>
               <th>RFQ Name</th>
               <th>RFQ Record ID</th>
               <th>Date Requested</th>
               <th>Date Needed</th>
               <th>Sales Rep</th>
            </tr>
 <tr>
             <apex:repeat var="cx" value="{!RelatedTo.RFQs__r}">
             
                <td><a href="https://na57.salesforce.com/{!cx.id}">View</a> |  
                <a href="https://na57.salesforce.com/{!cx.id}/e">Edit</a></td>
                <td>{!cx.RFQs.name}</td>
                <td>{!cx.RFQs.Record_Id__c}</td>
                <td>{!cx.RFQs.Date_Requested__c}</td>
                <td>{!cx.RFQs.Date_Needed__c}</td>
                <td>{!cx.RFQs.SalesRep__c}</a></td>
  
            </apex:repeat> 
           </tr>              
          </table>
            <p/>
                <apex:outputLink value="impact://matthews/salesforce/forms/model%20admin">
                    View this opportunity in ImpactECS
                </apex:outputLink>

            </body>
        </html>
    </messaging:htmlEmailBody>

<messaging:plainTextEmailBody >
Congratulations!
This is your new Visualforce Email Template.
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

This is the current code version!