Skip to main content
Hello, 

I have a VF email template with a table, and would like to conditionally render a table row if it meets a certain criteria.  For some reason, this is not working and when I send a test email I just get a massive list of every record of that object type.  

Here is my code: 

 

<apex:repeat value="{!relatedTo.SalesTeamClients__r}" var="client">

<tr style="display: {!IF(client.SalesStatus__c ='SPECIFIED_CONDITION', 'table-row', 'none')}">

<td width="300">{!client.FieldValue__c}</td>

<td width="200">{!client.FieldValue__c}</td>

<td width="200">${!client.FieldValue__c}0</td>

</tr>

</apex:repeat>

Shouldn't this in theory only display rows that meet the condition?

Thanks in advance for your help! 

John
3 respuestas
  1. 22 dic 2015, 17:46
    In general, email templates don't play well with css.  Instead of using display:none, try using the rendered attribute inside of an apex:outputText or apex:outputPanel:

     

    <apex:repeat value="{!relatedTo.SalesTeamClients__r}" var="client">

    <apex:outputText rendered="{!IF(client.SalesStatus__c ='SPECIFIED_CONDITION',true,false)}">

    <tr>

    <td width="300">{!client.FieldValue__c}</td>

    <td width="200">{!client.FieldValue__c}</td>

    <td width="200">${!client.FieldValue__c}0</td>

    </tr>

    </apex:outputText>

    </apex:repeat>

     
0/9000