ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How to add document link in Email Template


#1

Hello,

Can anyone tell me on how to add a document link in the Email Template?

Scenario: When an Employee applies for a leave application, the follow via email is checked. An Email Template called Leave approval notification will be sent to Leave approver. But there is no link to that particular document in the notification mail.

So, is it possible to include document link, so that leave approvers can click on that link and get to that document? Same thing should be applicable for Leave status notification template.

Please help.

Thanks & Regards,
Sujay


#2

I think this can help in your email template (any email template or doctype);

<a href="{{ frappe.utils.get_url_to_form(doc.doctype, doc.name) }}">{{ doc.employee_name}}'s Leave Application </a>

Cheers


#3

Hello,

Can you please tell me where should I include this code?


#4

Should be included in your email alert (notification in v11). Here’s an example of a notification I use

<h3>New Customer Issue</h3>

<p>A new customer issue has been recorded for {{ doc.customer }} by {{ doc.owner }}. Kindly view details below and take necessary action.</p>

<p> Link: <a href="{{ frappe.utils.get_url_to_form(doc.doctype, doc.name) }}">{{ doc.customer }} Customer Issue </a> </p>

<!-- show last comment -->
{% if comments %}
Last comment: {{ comments[-1].comment }} by {{ comments[-1].by }}
{% endif %}

<h4>Details</h4>

<ul>
<li>Customer: {{ doc.customer }}
<li>Priority: {{ doc.priority }}
</ul>