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
Shamus Kelley 4Shamus Kelley 4 

How to add a hyperlink to a visualforce email template

I have a visualforce email template that uses merge fields. Our sales users would like the Contact Name to be more than just text. They would like that particular field value to be a hyperlink to that record in salesforce. Is this possible? If so, how can that be done?

I've included an image of current code. I assume the adjustment would be made with the relatedTo.Name portion on line 14. 

Thank you -

User-added image
@Karanraj@Karanraj
Update the line number 16 with the following code
<span>
<a href="http://login.salesforce.com/{!RelatedTo.ID}">{!relatedTo.Name}</a>
</span>
or
<span>
<apex:outputlink value="http://login.salesforce.com/{!RelatedTo.ID}">{!relatedTo.Name}</apex:outputlink>
<span>


 
Hargobind_SinghHargobind_Singh
Hi, you can simply use the HTML link tag to create the hyperlink. Just a note though that it won't work on text-email readers. 

e.g. : 

<a href="YourUrlHere"><apex:outputText .....> </a>