[SalesForce] Adding link to a related record in HTML Email template

I'm trying to add a detail link to an HTML Email template, to link to a related record on the object being merged into the e-mail.

I am aware of the process for adding a link/detail link for the object in the template by using

{!Communication__c.Link}

But my Communication object has a lookup to a Case called ParentId__c (which I can be sure is not null..) and I want to link to THIS object… my initial thought was to use

{!Communication__c.ParentId__r.Link} 

and it would traverse the relationship, and then merge out the Link value as with other objects, but this has not worked.

I'd rather not "build" the URL using "company URL" etc. and I'd like to avoid adding more custom fields to the object, but if these sorts of ideas are our only option…so be it.

Best Answer

From what I remember standard emails (= non-Visualforce ones) will give you hard time when you want to use more than one dot to go "up".

I'm aware of only 2 workarounds you have mentioned:

  • a helper formula field (type = URL maybe? so it's at least a bit reusable); I've created "Case Contact's Phone" etc that way in the past
  • craft the URL by hand using the trick described in Detail page link under email template