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
Static DevStatic Dev 

How to have Links in a Visual force Email template which can open a VF page or Alert box.

Hello,

 

i am working on a Email Visual force template. In that Visual force template i need to have links as we cannot implement command buttons i guess.  When we click on the link it should either redirect to Visual force page or open pop window like alert or confirmation box using java script. Now how could i achieve this when we click the link given in the VF Email template a VFpage or an alert or confirmation box opens up.

 

Please do help on this.

 

 

Thank you.

pmozz01pmozz01

If I am reading your questions correctly, just use HTML:

 

 

<br/>Tracking Link:    <a href="http://boxoh.com?t={!RelatedTo.Tracking_Numbers__c}">http://boxoh.com?t={!RelatedTo.Tracking_Numbers__c}</a>

 

 

Ken KoellnerKen Koellner

But is there a way to get a link relative to your org?

 

The example below is in the docuementation but it is b-a-d bad.  There's a hard-coded reference to the node.  That means it won't be portable from a sandbox and if your org ever moves to a different node, you'll have to change your template.

 

01	<apex:repeat var="cx" value="{!relatedTo.Cases}">
02	   <tr>
03	       <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> | 
04	       <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>
05	       <td>{!cx.CaseNumber}</td>
06	       <td>{!cx.Subject}</td>
07	       <td>{!cx.Contact.email}</td>
08	       <td>{!cx.Status}</td>
09	   </tr>
10	</apex:repeat>

 

textualtextual

i agree that hardcoding server domain is super bad idea

but if thats all you got, thats all you got

 

im disappointed i cant use the Case.Link which works in regular email templates

 

:(

Starz26Starz26

How about: (passing into VF Template Component / controller then using that in the email)

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm

 

String fullRecordURL = URL.getSalesforceBaseUrl().toExternalForm() + '/' + acct.Id;