+ Start a Discussion

Output link with url field fusion in visualforce email template



I need some help with using an url field in a visualforce email template.


Here's my code :


<messaging:emailTemplate subject="Email subject" recipientType="Contact" relatedToType="Opportunity" 
replyTo="{!$User.Email}" >
<messaging:htmlEmailBody >
<apex:dataTable value="{!relatedTo.OpportunityLineItems}" var="line" width="100%">
<apex:column >
<apex:outputLink value="{!line.PricebookEntry.Product2.WebLink__c}">Link</apex:outputLink>


In the generated email, if the field WebLink__c doesn't begin with 'http://' Salesforce replaces it with "https://eu3.salesforce.com/email/author/".


For exemple, if I have 'http://www.salesforce.com' in the field WebLink__c, I'm correctly redirected.


Instead if I have 'www.salesforce.com' in the field WebLink__c, I'm redirected to "https://eu3.salesforce.com/email/author/www.salesforce.com" which leads to the Salesforce login page (https://login.salesforce.com).


Is there a way to make work properly for fields without 'http://' (e.g. a param for apex:outputlink) ?


Thanks for your help.