When we create an opportunity we create a certain number of quotes (custom, child record). I would like to be able to send an email to include information from all the quotes created under the opportunity.This is my first visualforce email template. I want to be able to pull I need some help because when I go to save I receive the following errors:

Error: VF_Test line 31, column 27: XML document structures must start and end within the same entity Error: XML document structures must start and end within the same entity.

My Email Content:

<messaging:emailTemplate recipientType="User"
                     subject=" {!Opportunity.Account}, {!Quotes_RFR__c.Current_Carrier__c}, {!Opportunity.Date_Due__c},{!Opportunity.Total_Eligible__c}" >
<messaging:htmlEmailBody >  
            <STYLE type="text/css">
                TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
                TD  {font-size: 11px; font-face: verdana } 
                TABLE {border: solid #CCCCCC; border-width: 1}
                TR {border: solid #CCCCCC; border-width: 1}
            <font face="arial" size="2">
                <table border="0" >
                    <tr > 
                        th><th>Quote Number</th><th>Contribution Type</th><th>In Network</th><th>Out of Network</th>
                    <apex:repeat var="cx" value="{!Quotes_RFR__c}">
                            <td>{!Quotes_RFR__c.Quote_Name__c} </td>
                            <td>{!Quotes_RFR__c.In_NetworkDiag_Prev__c}/ {!NullValue(Quotes_RFR__c.In_Network_Basic__c, "0")}/ {!NullValue(Quotes_RFR__c.In_Network_Major__c, "0")}/ {!NullValue(Quotes_RFR__c.In_Network_Ortho__c, "0")}; {!Quotes_RFR__c.In_Network_Deductible_Ind__c}/ {!Quotes_RFR__c.In_Network_Deductible_Fam__c} Ded; {!Quotes_RFR__c.In_Network_Annual_Max__c} Max; {!NullValue(Quotes_RFR__c.In_Network_Ortho_Max__c, "0")}</td>
                            <td>{!Quotes_RFR__c.Out_Network_Diag_Prev__c}/ {!NullValue(Quotes_RFR__c.Out_Network_Basic__c, "0")}/ {!NullValue(Quotes_RFR__c.Out_Network_Major__c, "0")}/ {!NullValue(Quotes_RFR__c.Out_Network_Ortho__c, "0")}; {!Quotes_RFR__c.Out_Network_Deductible_Ind__c}/ {!Quotes_RFR__c.Out_Network_Deductible_Fam__c} Ded; {!Quotes_RFR__c.Out_Network_Annual_Max__c} Max; {!NullValue(Quotes_RFR__c.Out_Network_Ortho_Max__c, "0")} </td>
                <p />
  • Sorry, it cut off the end of it:
    – Michelle
    Mar 22, 2017 at 16:36
  • I don't think <p> is a valid self closing tag... You also have a seeming typo as your header row leads off with th>.
    – Adrian Larson
    Mar 22, 2017 at 16:40
  • 3
    @Michelle: Are you sure this is the complete code? If yes, could you try adding </messaging:emailTemplate > at the end? Mar 22, 2017 at 16:40
  • @shailesh that could be issue. You can maybe add it as an answer. You beat me to it by few seconds :D
    – Raul
    Mar 22, 2017 at 16:42
  • @ShaileshPatil I added that at the end and the error message now reads: Unknown property 'core.email.template.EmailTemplateController.Opportunity'
    – Michelle
    Mar 22, 2017 at 16:47

1 Answer 1


The issue is most likely on your repeat

<apex:repeat var="cx" value="{!Quotes_RFR__c}">

You will need

<apex:repeat var="cx" value="{!relatedTo.Quotes_RFR__r}">

relatedTo to bind to the target object used by the VF Email Template (i.e. an Opportunity) and Quotes_RFR__r which is the relationship name from Opportunity to the custom Quote object. (I'm making an assumption here on your names, but it will definitely end in __r)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.