Pages

Wednesday, October 13, 2021

Salesforce: Email Template with Hyperlink

We shared about the Lightning Email Template seven months ago, as you read, it is easy to create an email template with merged fields, such as Account Name, Opportunity Name, etc.

However, those merge fields are not clickable (not hyperlink), so if the email sent is to your internal Salesforce users, it will be ideal if recipients are able to open the link directly from the email received.

Let's do a quick hands-on, in this example, I would like to build an email template for Case, contain 2 hyperlinks:

  • Case Number, to open the case
  • Account Name, to open the Account in the case

Here is the step:

1. Create the email template 

Create the email template as per normal, add all merged fields needed


2. Case Number hyperlink

Open a case from your browser and grab the URL and copy to a text editor, for example, https://d90000000ky88eag.lightning.force.com/lightning/r/Case/50090000001O98rAAC/view

Change the Case ID (as in red) and replace with {{{Case.Id}}}, now we have https://d90000000ky88eag.lightning.force.com/lightning/r/Case/{{{Case.Id}}}/view

Copy the above URL, select {{{Case.CaseNumber}}} from the email template, then click the Link icon (2nd from right) and paste the URL above (in the yellow background) here, then click the Save button.


3. Account Name hyperlink

Repeat the same for Account Name, get the URL and change the Account Id, so it will look like
https://d90000000ky88eag.lightning.force.com/lightning/r/Account/{{{Case.AccountId}}}/view 

Copy the above URL, select {{{Case.Account__c}}} from the email template, then click the Link icon (2nd from right) and paste the URL above, then click the Save button.

If you notice I use Case.Account__c, this is simply telling that I have a formula field in Case to get Account Name from AccountId.


4. Sending Email

Open a case and click the Email tab, select the email template created, and notice the email body is auto-populated with hyperlinks.



Reference:



1 comment: