Notification Email for adding comment on document


I get notification when a comment is added on the document, but I need to know what was the content and I need to know some fields (like customer name and so on) for the document that a comment added to it.
For example:
If the document is task and there is customer field in it, I need to know the name of the customer. What I have to place in the email body of the notification?

I know that I can use doc.reference_doctype and doc.reference_name to know the doctype and the docname that the comment was added to it. But I need to know the customer name which is a field in that document, how to reach it? I need to be sent in the notification email.


You have reference doctype and docname, right?
If you have then you can modify the email alert message like this:

{% if doc.doctype == β€œyour doctype with customer name” %}
{% set ref_doc = frappe.get_doc(doc.reference_doctype, doc.reference_docname ) %}

{{ ref_doc.customer_name }}

{% endif %} β€˜β€™β€™

You can modify above code to reach to desired doctype and then reference doc customer field name.

1 Like