Monday, January 27, 2014

How to get “https” link instead of “http” for Visualforce page using URLFOR() in Email Template

How to get “https” link instead of “http” for Visualforce page using URLFOR() in Email Template

When you create the Link using URLFOR() in Email Template, it creates link in “http” format instead of “https” and thus causes end user to logged into salesforce again.

So instead of
<a href='{!URLFOR('/apex/SomePage', null, [id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"])}'>Go to SomePage here!</a>

We can use something like :
<a href='{!SUBSTITUTE(URLFOR('/apex/SomePage', null, [id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"]),'http:','https:')}'>Go to SomePage here!</a>
  

No comments:

Post a Comment