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.

3

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>
  • I usedthe same.But i'm checking for more clean options if there are any. – Sindoora Jun 12 '14 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 '14 at 12:23
  • Have you tried this: Link : <a href="{!RelatedTo.Link}">{!relatedTo.Link}</a><br/> – the_phantom Apr 23 '15 at 5:25
  • 1
    {!relatedTo.Link} won't work in VF email templates. – Vijay Prakash Oct 8 '18 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.