You need to sign in to do that
Don't have an account?
![Liz Malman Liz Malman](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Formatting a Merge Field in Visualforce Email Template
Hello all,
I'd like some help on how to change the formatting of one of my merge fields in my visualforce email template. The field I am merging is a text field but when the email is created, the formatting from the field does not carry over.
For example...
Text in the Field looks like this:
This is a test.
Please ignore this.
Text in the Email looks like this:
This is a test. Please ignore this.
Does anyone have any idea how to carry over the format from the text field?
Thanks,
Liz
I'd like some help on how to change the formatting of one of my merge fields in my visualforce email template. The field I am merging is a text field but when the email is created, the formatting from the field does not carry over.
For example...
Text in the Field looks like this:
This is a test.
Please ignore this.
Text in the Email looks like this:
This is a test. Please ignore this.
Does anyone have any idea how to carry over the format from the text field?
Thanks,
Liz
<h4>Event Info</h4>
<p>
<b>Event Name:</b> {!relatedTo.Name}<br/>
<b>Event Date: </b>
<apex:outputText value="{0, date, short}">
<apex:param value="{!relatedTo.Start_Date__c}"/>
</apex:outputText> <br/>
<b>Start Time: </b> {!relatedTo.Event_Start_Time__c}<br/>
<b>Show Code: </b> {!relatedTo.SV_Show_Code__c}<br/>
<b>Mobile Unit: </b> {!relatedTo.Mobile_Unit__c}<br/>
<b>Venue: </b> {!relatedTo.Venue__r.Name}<br/>
<b>Tech Manager: </b> {!relatedTo.Technical_Producer__c} - {!relatedTo.Technical_Producer_Phone_Number__c} <br/>
<b>Producer:</b> {!relatedTo.Producer__c} <br/>
<b>Director: </b> {!relatedTo.Director__c} <br/>
<b>System: </b> {!relatedTo.SV_System__c} <br/>
<b>Notes: </b> {!relatedTo.Event_Notes__c} <br/>
</p>
Merge fields for Visualforce email templates use the same expression language as formulas:
{!Object_Name.Field_Name}
For example, you can start your email template with Hello, {!Contact.FirstName}. When you send the template, each recipient sees their first name in place of the merge field. If your recipient’s first name is John, he sees Hello, John! when he opens the email.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
Thank you for the response but that is not exactly what I'm looking for. I understand how merge fields work but I'm wondering if I can maintain the format of a text field in the emial template. When I merge the text field in the template, it changes the format.
The picture below shows how the field was filled out.
This next picture shows what the email template displays.
Do you see how it does not space the text in the same way? I want it to maintain its original spacing.
Regards
Gulraiz