I need to display a message based on a condition which has to be formatted with bold style, add line breaks, etc. Using HTML markup inside IF condition is not working in HTML email templates.

For example,

{!IF(customObject.customField__c = 'Expected Value', '<BR><UL><LI>Item1</LI><LI>Item2</LI></UL>', '')}

However, the same IF condition works if the message to be displayed is plain text.

Do you have any suggestions on this?

1 Answer 1


For HTML template, use div and set the style display conditionally

<div style="display: {!IF(customObject.customField__c = 'Expected Value', '' , 'none')}">

Alternative solution for visualforce email template

try with apex:ouptputpanel and use rendered attribute to show the content

<apex:outputpanel rendered="{!customObject.customField__c = 'Expected Value'}">
  • Thanks for your quick answer! Is there a way to do this in HTML email template? Oct 12, 2016 at 7:04
  • @VijayPrakash check the updated answer
    – Ratan Paul
    Oct 12, 2016 at 7:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .