+ Start a Discussion
rdgrdg 

Help with IF statement in a VF email template

Hi guys,

 

Need help with a complex (for a noob like me anyways) component in a VF email template.

 

Basically the VF code below will;

Display "Dear Contact Name A," if Custom_Field is NOT BLANK

or

Display "Dear Contact Name B," if Custom_Field is BLANK

 

How can I incorporate this in an IF Statement fashion so that;

Display "Dear Sir/Madam," if Account Type equals 'Organisation'

else

action the orginal function.

 

 

<apex:outputText value="Dear {!opportunity.Account.Contact_A}," Rendered="{!IF(ISBLANK(opportunity.Custom_Field), true, false)}" />
<apex:outputText value="Dear {!opportunity.Account.Contact_B}," Rendered="{!IF(ISBLANK(opportunity.Custom_Field), false, true)}" />

 

 

Thank you in advance,

Best Answer chosen by Admin (Salesforce Developers) 
rdgrdg

Worked it out! Thanks.

 

<apex:outputText value="Dear {!opportunity.Account.Contact_A}," Rendered="{!IF( ISBLANK(opportunity.Custom_Field), true, false)}" />

<apex:outputText value="Dear {!opportunity.Account.Contact_B}," Rendered="{!IF( NOT( ISBLANK( opportunity.Custom_Field)), true, false)}" />

<apex:outputText value="Dear Sir/Madam," Rendered="{!IF( AND( ISBLANK( opportunity.Custom_Field),  opportunity.Account.Type='Organisation'), true, false)}" />

 

All Answers

MagulanDuraipandianMagulanDuraipandian

http://infallibletechie.blogspot.in/2012/11/conditional-render-expression.html

 

check this...

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution and give Kudos.

rdgrdg

Worked it out! Thanks.

 

<apex:outputText value="Dear {!opportunity.Account.Contact_A}," Rendered="{!IF( ISBLANK(opportunity.Custom_Field), true, false)}" />

<apex:outputText value="Dear {!opportunity.Account.Contact_B}," Rendered="{!IF( NOT( ISBLANK( opportunity.Custom_Field)), true, false)}" />

<apex:outputText value="Dear Sir/Madam," Rendered="{!IF( AND( ISBLANK( opportunity.Custom_Field),  opportunity.Account.Type='Organisation'), true, false)}" />

 

This was selected as the best answer