+ 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
Update the line number 16 with the following code
<a href="http://login.salesforce.com/{!RelatedTo.ID}">{!relatedTo.Name}</a>
<apex:outputlink value="http://login.salesforce.com/{!RelatedTo.ID}">{!relatedTo.Name}</apex:outputlink>

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>