+ Start a Discussion
rdgrdg 

Help with simple IF statement in a VF email template

Hi there,

 

New to this.

 

Trying a (what probably is so simple) IF statement in a VF email template where I want an output "He" or "She" depending on the a Gender field in a related lookup record.

 

Here is my code which keeps returning a syntax error;

 

<apex:outputText value="{!IF ({!relatedTo.Custom_Contact__r.Gender__c} =='Male', 'He', 'She')}"></apex:outputText>

 

Thank you in advance!

 

 

regards,

 

Al

Best Answer chosen by Admin (Salesforce Developers) 
Coco_SdyneyCoco_Sdyney

<apex:outputText value="{!IF (relatedTo.Custom_Contact__r.Gender__c =='Male', 'He', 'She')}"></apex:outputText>

All Answers

Coco_SdyneyCoco_Sdyney

<apex:outputText value="{!IF (relatedTo.Custom_Contact__r.Gender__c =='Male', 'He', 'She')}"></apex:outputText>

This was selected as the best answer
rdgrdg

Awesome!

 

Thank you very much.