I am creating a confirmation email to be sent when a new Orders__c
is created via an external form. These are not related objects so an <apex:repeat>
solution is not viable. There are 50+ fields that may be shown and I would like to avoid having a bunch of blank rows.
My ideal solution would be the equivalent of adding rendered="{!IF(relatedTo.Item1__c == null, false, true)}"
to the <tr>
tag, but I don't reckon that's an option in static HTML.
<messaging:emailTemplate relatedToType="Orders__c" subject="Order Received: {!relatedTo.Name}" replyTo="[email protected]">
<messaging:htmlEmailBody >
<html>
<body>
<p>Thank you for submitting your order. It has been received and will be processed shortly. You will receive notification when the order has shipped.</p>
<br/>
<br/>
<center>
<p>Order Summary</p>
</center>
<p>Order: {!relatedTo.Name}</p>
<p>Order Received: {!relatedTo.Submitted__c}</p>
<p>Date Needed By: {!relatedTo.Date_Needed_By__c}</p>
<br/>
<p>Site Code: {!relatedTo.Site_Code__c}</p>
<p>TCA Name: {!relatedTo.TCA_Name__c}</p>
<p>TCA Email: {!relatedTo.TCA_Email__c}</p>
<p>TCA Phone: {!relatedTo.TCA_Phone__c}</p>
<br/>
<br/>
<p>Total Items Ordered: <apex:outputField value="{!relatedTo.Total_Items_Ordered__c}" /></p>
<p>Notes: <apex:outputField value="{!relatedTo.Notes__c}" /></p>
<table border="1">
<tr> //HIDE THIS IF Item1__c == 0
<td>Item1: </td> //HIDE THIS IF Item1__c == 0
<td colspan="2"> <apex:outputField value="{!relatedTo.Item1__c}" /> </td> //HIDE THIS IF Item1__c == 0
</tr> //HIDE THIS IF Item1__c == 0
<tr> //HIDE THIS IF Item2__c == 0
<td>Item2: </td> //HIDE THIS IF Item2__c == 0
<td colspan="2"> <apex:outputField value="{!relatedTo.Item2__c}" /> </td> //HIDE THIS IF Item2__c == 0
</tr> //HIDE THIS IF Item2__c == 0
/* long list of items*/
</table>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
<tr>
withapex:outputPanel
and use rendered= there?