How to add document link in Email Template


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,

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.employee_name}}'s Leave Application </a>




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

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.customer }} Customer Issue </a> </p>

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


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