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
Jingyuan XieJingyuan Xie 

Help on adding field filter to make conditionally display field value with a email template table

Hi all,
I had an existing VF email template that display a table show all related(Child)Cases for case, see the code here, i also want to add one more filter that only display all closed(case status=closed) related cases within the table . To make this i created a apex class for fetching list of closed cases , but i dont know how to refer this into a component that conbine the email template table so that i can invoke the component in me email template , can anyone help give some light on this? thanks

<messaging:emailTemplate recipientType="Contact"
  relatedToType="case"
  subject=" XXX report for Case Number: {!relatedTo.casenumber}"
  replyTo="XXX">
  <messaging:htmlEmailBody >
    <html>
      <body>
        <STYLE type="text/css">
          TH {font-size: 11px; font-face: arial;background: #CCCCCC;
               border-width: 0;  text-align: center } 
          TD  {font-size: 11px; font-face: verdana } 
          TABLE {border: solid #000000; border-width: 1;border="1"}
          TR {border: solid #000000; border-width: 1}
        </STYLE>
        <font face="arial" size="2">
          <p>Dear {!recipient.name},</p>
          <p>Below is the detail of your parentcase: {!relatedTo.casenumber}.</p>
          <table border="0" >
            <tr > 
               <th>Childcase #</th>
               <th>Problem Found</th>
               <th>Status</th>
            </tr>
            <apex:repeat var="cx" value="{!relatedTo.cases}">
              <tr>
                <td>{!cx.casenumber}</td>
                <td>{!cx.Problem_Found__c}</td>
                <td>{!cx.status}</td>
              </tr>
            </apex:repeat>   
              
          </table>
                   
          <p />
        </font>
       
      </body>
       
    </html>
  </messaging:htmlEmailBody> 
   </messaging:emailTemplate>