4

In HTML email template, we can use {!Lead.Link} option to access the url inside salesforce.

But i found this {!Lead.Link} can't be used in vf email template. I tried using {!relatedTO.Link}. But this shows error as:

Invalid field Link for SObject Lead

Any idea like how to get this field accessed in vf email template.

1 Answer 1

4

I don't know if there is a "clean" way to do this. But this seems to be a fairly popular hack:

<a href="{!LEFT($Api.Partner_Server_URL_280, FIND(".com/",$Api.Partner_Server_URL_280)+3)}/{!relatedTo.Id}">
    {!relatedTo.Name}
</a>
5
  • I usedthe same.But i'm checking for more clean options if there are any.
    – Sindoora
    Jun 12, 2014 at 9:54
  • In apex there's URL.toExternalForm() call available but it would mean your VF email template needs to use a component (and that component would have the apex class as controller). Not worth the effort I'd say...
    – eyescream
    Jun 12, 2014 at 12:23
  • Have you tried this: Link : <a href="{!RelatedTo.Link}">{!relatedTo.Link}</a><br/> Apr 23, 2015 at 5:25
  • 1
    {!relatedTo.Link} won't work in VF email templates. Oct 8, 2018 at 12:28
  • these links dont seem to be picked up by the salesforce mobile app...hard to row in one direction.
    – gorav
    Jun 16, 2023 at 20:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .