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
Ti Saunders 8Ti Saunders 8 

Error: The element type "tr" must be terminated by the matching end-tag "</tr>".

I'm writing a VisualForce email template and getting this error:
Error: Win_Notes_Tix_VF line 65, column 31: The element type "tr" must be terminated by the matching end-tag "</tr>"
Error: The element type "tr" must be terminated by the matching end-tag "</tr>".
 
<messaging:emailTemplate recipientType="Contact"
    relatedToType="Opportunity"
    subject="Congratulations to {!relatedTo.Owner.Name} for the {!relatedTo.Sale_Type__c} win with {!relatedTo.Account}"
    replyTo="salesforcesupport@rft.com" >
   
<messaging:htmlEmailBody>        
    <html>
        <body>
            <p style="font-size: 16px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">
                Dear Sales:
                <br/>
                <br/>
                Congratulations to <strong>{!relatedTo.Owner.name}</strong> for the {!relatedTo.Sale_Type__c} win with {!relatedTo.Account} 
                <br/>
                <br/>
                Term: {!relatedTo.Term__c} Months
                <br/>
                <br/>
                Manager: {!relatedTo.Manager__c }
                <br/>
                <br/>
                Connect Ticket Sold: {!relatedTo.Connect_Tickets__c}
                <br/>
                <br/> 
                Was Conference discussed/ positioned: {!relatedTo.Was_Conference_Discussed__c}
                <br/>
                <br/>
                Reason for conference ticket not sold: {!relatedTo.Reason_for_Tickets_Not_Sold__c}
                <br/>
                <br/> 
                Close Date: {!relatedTo.CloseDate}
                <br/>
                <br/> 
               ARR (USD): {!relatedTo.Forecast_Amount__c}
                <br/>
                <br/>
                Total Opportunity Value (TCV): {!relatedTo.Total_Cash_Value_TCV__c}
                <br/>
                <br/>
                Reason for Win: {!relatedTo.Reason_for_Win__c}
                <br/>
                <br/>           
                <strong> Win Notes: </strong>  {!relatedTo.Win_Notes__c}
                <br/>
                <br/>
                <strong>Growth and Cross Sell Opportunities: </strong>{!relatedTo.Growth_and_Cross_Sell__c}
                <br/>
                <br/>
                <strong>Products Sold: </strong>
                <table border="1" cellspacing="0" cellpadding="4" style="font-size: 16px; font-family: Arial, Helvetica, sans-serif;">
                    <tr align="left"> 
                        <th >Product Name</th>
                        <th >SKU</th>
                        <th >Quantity</th>
                        <th >ACV</th>
                    </tr>
                    <apex:repeat var="oli" value="{!relatedTo.OpportunityLineItems}">
                        <tr>
                            <td >{!oli.PriceBookEntry.name}</td>
                            <td >{!oli.Product2}</td>
                            <td align="right" >{!ROUND(oli.Quantity,0)}</td>
                                <apex:outputText value="{0, currency}">
                                      <apex:param value="{!ROUND(oli.ARI__c,0)}" />
                                </apex:outputText>                          
                            </td>                        
                        </tr>
                    </apex:repeat>
                </table>
                <br/>
            </p>
        </body>
    </html>
</messaging:htmlEmailBody> 
</messaging:emailTemplate>

 
Best Answer chosen by Ti Saunders 8
Ajay K DubediAjay K Dubedi
Hi Ti,

I have looked through your code. Look at the second <tr> block(from line 58 to line 66). 
You have opened 3 <td> blocks but closed 4 </td> blocks. Just put opening <td> block in line 62.
Here, I have done it for you.


<messaging:emailTemplate recipientType="Contact"
    relatedToType="Opportunity"
    subject="Congratulations to {!relatedTo.Owner.Name} for the {!relatedTo.Sale_Type__c} win with {!relatedTo.Account}"
    replyTo="salesforcesupport@rft.com" >
   
<messaging:htmlEmailBody>        
    <html>
        <body>
            <p style="font-size: 16px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">
                Dear Sales:
                <br/>
                <br/>
                Congratulations to <strong>{!relatedTo.Owner.name}</strong> for the {!relatedTo.Sale_Type__c} win with {!relatedTo.Account} 
                <br/>
                <br/>
                Term: {!relatedTo.Term__c} Months
                <br/>
                <br/>
                Manager: {!relatedTo.Manager__c }
                <br/>
                <br/>
                Connect Ticket Sold: {!relatedTo.Connect_Tickets__c}
                <br/>
                <br/> 
                Was Conference discussed/ positioned: {!relatedTo.Was_Conference_Discussed__c}
                <br/>
                <br/>
                Reason for conference ticket not sold: {!relatedTo.Reason_for_Tickets_Not_Sold__c}
                <br/>
                <br/> 
                Close Date: {!relatedTo.CloseDate}
                <br/>
                <br/> 
               ARR (USD): {!relatedTo.Forecast_Amount__c}
                <br/>
                <br/>
                Total Opportunity Value (TCV): {!relatedTo.Total_Cash_Value_TCV__c}
                <br/>
                <br/>
                Reason for Win: {!relatedTo.Reason_for_Win__c}
                <br/>
                <br/>           
                <strong> Win Notes: </strong>  {!relatedTo.Win_Notes__c}
                <br/>
                <br/>
                <strong>Growth and Cross Sell Opportunities: </strong>{!relatedTo.Growth_and_Cross_Sell__c}
                <br/>
                <br/>
                <strong>Products Sold: </strong>
                <table border="1" cellspacing="0" cellpadding="4" style="font-size: 16px; font-family: Arial, Helvetica, sans-serif;">
                    <tr align="left"> 
                        <th >Product Name</th>
                        <th >SKU</th>
                        <th >Quantity</th>
                        <th >ACV</th>
                    </tr>
                    <apex:repeat var="oli" value="{!relatedTo.OpportunityLineItems}">
                        <tr>
                            <td >{!oli.PriceBookEntry.name}</td>
                            <td >{!oli.Product2}</td>
                            <td align="right" >{!ROUND(oli.Quantity,0)}</td>
                            <td>   <apex:outputText value="{0, currency}">
                                      <apex:param value="{!ROUND(oli.ARI__c,0)}" />
                                </apex:outputText>                          
                            </td>                        
                        </tr>
                    </apex:repeat>
                </table>
                <br/>
            </p>
        </body>
    </html>
</messaging:htmlEmailBody> 
</messaging:emailTemplate>

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com