function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SjaleelSjaleel 

Making merge fields conditional

Can merge fields be made conditional in the HTML  email template....

 

I want to test the condition whether a revenue is specified or not, if yes then give out the revenue other wise no revenue specified..

 

{ ! IF(Operator__c.Revenue__c > 0," An operator with revenue "{!Operator__c.Revenue__c},"Revenue not specified")}

 

Well it doesn't work, that I know but is there any way I could make it conditional and work?

 

Thanks and regards

ministe2003ministe2003

You could have two different statements with Rendered conditions on them, like

 

<apex:outputText value="An operator with revenue {!Operator__c.Revenue__c}" rendered="{!Operator__c.Revenue__c > 0}" />

<apex:outputText value="Revenue not specified" rendered="{!NOT(Operator__c.Revenue__c > 0)}" />

 

if that syntax isnt 100% im sure you can work it out from that.

SjaleelSjaleel

Thanks for the reply, but isn't it if am doing my template in VF that apex coding is used is it not possible to do the same in the HTML version of the email??

flewellsflewells
Assuming you're working within an HTML email template (and not VF), the only thing I can think of is to create a new custom formula field on your object that handles the logic for you, then display that field in your email template. Would be interested to hear if other people have different suggestions.