You need to sign in to do that
Don't have an account?
Email Template Line Break within a conditional IF statement
Within an if statement I want to print a line break to the screen. However, there seems to be no easy way to do this in any forums thus far. I found a few answers, but none of them seem to work within the TRUE argument in my IF conditional statement. Here is a snippet of my code:
{! IF (relatedTo.Budget_In_Stream_Video__c != null, "In-Stream Video", null)}
{! IF (relatedTo.Budget_Interactive_InStream_Video__c != null, "Interactive In-Stream Video", null)}
Outputs
I have tried \n, <br/>, and many others with little or no success. BR() only gives this output:
In-Stream Video_BR_ENCODED_Interactive In-Stream Video
Someone please tell me I'm crazy and this isn't that hard and doesn't require some crazy hack...
Do you just use the if statement in your Email Template?
What type of the email template do you create?
Have you try CHAR(10)?
Use <apex:outputpanel> tag with render attribute
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_outputPanel.htm
I don't think any VF tags will work in the Email Template...
@Chris
I don't only use the if statement in my email template. I am currently using HTML format, not plain text, because I only want a line feed when the if statement is true. Here is the whole section of the template with the if statements:
Ad Units:
{! IF (relatedTo.Budget_In_Stream_Video__c != null, "In-Stream Video" , null)}
{! IF (relatedTo.Budget_Interactive_InStream_Video__c != null, "Interactive In-Stream Video
", null)}
{! IF (relatedTo.Budget_In_Stream_Video_Blend__c != null, "In-Stream Video (Blend)", null)}
{! IF (relatedTo.Budget_FPA__c != null, "Smartphone Full Page", null)}
{! IF (relatedTo.Budget_App_Banner__c != null, " Smartphone Banner", null)}
{! IF (relatedTo.Budget_In_Banner_Video__c != null, "Smartphone In-Banner Video", null)}
{! IF (relatedTo.Budget_Tablet_Full_Page__c != null, "Tablet Full Page", null)}
{! IF (relatedTo.Budget_Tablet_Leaderboard__c != null, "Tablet Banner", null)}
{! IF (relatedTo.Budget_Tablet_In_Banner_Video__c != null, "Tablet In-Banner Video", null)}
{! IF (relatedTo.Budget_Video_Blend__c != null, "Video (Blend)", null)}
{! IF (relatedTo.Budget_Display_Blend__c != null, "Display (Blend)", null)}
{! IF (relatedTo.Budget_Sponsorship__c != null, "Sponsorship", null)}
Basically, what I want to do is create a list of these items, but not have them spaced out in a weird way. I want a line feed after each if statement, but only if it turns out to be true.
I don't know about CHAR(10) or how you would format that. I've tried this:
{! IF (relatedTo.Budget_In_Stream_Video__c != null, "In-Stream Video"+'CHAR(10)' , null)}
But no luck.
@krisk
I tried <apex:outputPanel>, but got nothing. What do you use for the line feed? I tried \n, <br/> and &BR() with no luck. Also, the rendered attribute defaults to true for outputpanel so no need to specify it even though I did...
I guess there really isn't a possible solution to this...
<apex:outputText rendered="{! IF (relatedTo.Budget_In_Stream_Video__c != null)}">In-Stream Video<br/></apex:outputText>
The outputtext along with the linebreak will be rendered only when the Budget_In_Stream_Video__c !=null. Otherwise, the text and the linebreak are both not displayed.
<apex:outputPanel rendered="{!IF(contains(relatedTo.mySalesforceField__c,'TRU;'), true, false)}">
This line will show when the value in the mySalesforceField contains TRU;
</apex:outputPanel>