I'm trying to figure out how to omit text in a custom email template when a field is blank. To be more specific, I added Account to the custom auto generated email template that I have built and it works fine but when/if the Account is blank then I want to remove the additional text I added to specify Account.
Can this be done via a formula field or IF statement in the HTML email template? If so, can someone how to accomplish this please?
2 risposte
You can use an <apex:outputText> tag with a rendered property to dynamically show text in a visualforce email template. Here's an example:
<apex:outputText rendered="{!relatedTo.AccountId != ''}">Check out this <a href="https://www.google.com">hyperlink</a> that is shown when the AccountId field is not an empty string.</apex:outputText>
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_outputText.htm