[SalesForce] vf email template – detail Link

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.

Best Answer

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>
Related Topic