How to access a linked document in Jinja


I can’t access a field in a linked document with Jinja. Should this be possible, or is there some error in my coding?

Frappe 13.32
Custom App ePerform

The below DocType contains a link to the above DocType

I create a Notification, triggered on the Save event of eP Test 2 DocType with a message as follows

Screenshot from 2022-06-20 18-03-07

The resulting Alert is as follows

Screenshot from 2022-06-20 18-03-31

As can be seen the {{ doc.test1.data1 }} Jinja statement gives the following error {{ no such element: str object[‘data1’] }}.

What am I doing wrong?

The link field is just storing “name” of the linked object, it’s not a document object.

You can use ORM to get value from that doctype. Something like: frappe.db.get_value(doctype, doc.test1, "data1")


Thanks so much @ankush

From your inspiration, this works for me

{% set t1 = frappe.get_doc(“eP Test1”, doc.test1) %}

{{ t1.data1 }}