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

If Condition in visualforce email template
I have 3 fields 1) shipping_type__c 2) Total_Shipping__c 3) CheckOut__c
when shipping_type__c = 0 at this condition i want to show CheckOut__c values in visualforce template
when shipping_type__c = 1 And 2 at this condition i want to show Total_Shipping__c fields values in email template
how can i write the if condition in visualforce email template
<messaging:emailTemplate recipientType="Contact" relatedToType="Quote__c" subject="Your requested quote #{!relatedTo.Name}" >
<tr>
<td align="right" style="width:90%">
<apex:outputText value="Shipping and handling"/></td>
<td align="right" style="width:10%; font-weight:bold">
<apex:outputField value="{!relatedTo.Total_Shipping__c}"/></td>
</tr>
<tr>
<td align="right" style="width:90%">
<apex:outputText value="Shipping and handling"/></td>
<td align="right" style="width:10%; font-weight:bold">
<apex:outputField value="{!relatedTo.Total_Shipping__c}"/></td>
</tr>
</messaging:emailTemplate>
when shipping_type__c = 0 at this condition i want to show CheckOut__c values in visualforce template
when shipping_type__c = 1 And 2 at this condition i want to show Total_Shipping__c fields values in email template
how can i write the if condition in visualforce email template
<messaging:emailTemplate recipientType="Contact" relatedToType="Quote__c" subject="Your requested quote #{!relatedTo.Name}" >
<tr>
<td align="right" style="width:90%">
<apex:outputText value="Shipping and handling"/></td>
<td align="right" style="width:10%; font-weight:bold">
<apex:outputField value="{!relatedTo.Total_Shipping__c}"/></td>
</tr>
<tr>
<td align="right" style="width:90%">
<apex:outputText value="Shipping and handling"/></td>
<td align="right" style="width:10%; font-weight:bold">
<apex:outputField value="{!relatedTo.Total_Shipping__c}"/></td>
</tr>
</messaging:emailTemplate>
Please follow the below link to understand the use of the if condition in the Visualforce page.
http://salesforce.stackexchange.com/questions/21405/how-can-i-have-if-else-if-in-a-vf-page
http://stackoverflow.com/questions/20671252/visualforce-if-statement-need-to-know-syntax-for-or
https://developer.salesforce.com/forums/ForumsMain?id=906F000000094JxIAI
Thanks
Vikash_SFDC