Please help me to get one of the following values based on True/False in VF Email Template.

I need to display a value/message based on true or false of this if

{!if(relatedTo.subject__r.name='OpportunitySale Salect',true,false)
  • if it is true then "Here you can get driver information!"
  • If it is false then "Here you can get driver's state information"

<apex:outputtext rendered="{!if(relatedTo.subject__r.name='OpportunitySale Salect',true,false)}">


Why not replace true and false in your formula with the strings you provided for both cases? You can also create two outputText tags, each with it's own rendering condition. So if one is rendered the other isn't:

<apex:outputText rendered="{!condition1}" value="{!text1}"></apex:outputText>
<apex:outputText rendered="{!condition2}" value="{!text2}"></apex:outputText>
   value="{!IF(relatedTo.subject__r.name = 'OpportunitySale Salect',
              'Here you can get driver information!',
              'Here you can get driver's state information')}"/>

Note that dynamically setting the value property of an apex component isn't supported for all components, like inputField or outputField.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.