You need to sign in to do that
Don't have an account?

Help with IF statement for a VF email template
Hi,
Could you please help me write an IF statement (I think that's what I need?) for my Visualforce email template?
I have a VF email template that (among other things) pulls all information from the opportunity contact role related list. What I really would like is for it to just pull the information from one specific role = "Delivery Contact". So that if several roles are specified in the list the others will not show up in my email, and if the role "Delivery Contact" is not specified at all in the opportunity contact role related list the table is left blank.
Is it an IF statement I need, and how would it look?
This is my code:
<p>
<table border="0" width="560">
<tr >
<th>Role</th><th>Name</th><th>Email</th><th>Phone</th><th>Primary Contact?</th>
</tr>
<apex:repeat var="ContactRole" value="{!relatedTo.OpportunityContactRoles}">
<tr>
<td>{!ContactRole.Role}</td>
<td>{!ContactRole.Contact.Name}</td>
<td>{!ContactRole.Contact.Email}</td>
<td>{!ContactRole.Contact.Phone}</td>
<td>{!ContactRole.IsPrimary}</td>
</tr>
</apex:repeat>
</table>
</p>
Thanks in advance!
Try something like this
<apex:repeat var="ContactRole" value="{!relatedTo.OpportunityContactRoles}">
<apex:outputPanel rendered="{!ContactRole.Role ='Delivery Contact'}">
<tr>
<td>{!ContactRole.Role}</td>
<td>{!ContactRole.Contact.Name}</td>
<td>{!ContactRole.Contact.Email}</td>
<td>{!ContactRole.Contact.Phone}</td>
<td>{!ContactRole.IsPrimary}</td>
</tr>
</apex:outputPanel>
</apex:repeat>
All Answers
Try something like this
<apex:repeat var="ContactRole" value="{!relatedTo.OpportunityContactRoles}">
<apex:outputPanel rendered="{!ContactRole.Role ='Delivery Contact'}">
<tr>
<td>{!ContactRole.Role}</td>
<td>{!ContactRole.Contact.Name}</td>
<td>{!ContactRole.Contact.Email}</td>
<td>{!ContactRole.Contact.Phone}</td>
<td>{!ContactRole.IsPrimary}</td>
</tr>
</apex:outputPanel>
</apex:repeat>
Works perfectly! Thank you so much!