Document Creator

On my Print Format, I want to retrieve the name of the user who created the document. I tried using doc.owner, but this gives me the user ID / email address. How can I retrieve the doc.owner’s full name?

Thanks.

Python code for the same is below. As i have not dived into print formats yet, so could not give you exact syntax.

from frappe.utils import get_fullname
get_fullname(owner)

doc.owner would be foreign key to the user table. In a print format you could then fetch the name as follows:

{% set u = frappe.get_doc("User", doc.owner) %}
...
{{u.first_name}} {{ u.last_name }}  

The jinja renderer fails if you try to do python style imports directly in the template. Still digging into this myself

2 Likes

That is by desgin. Your approach with get_doc looks good.

Thank you! Works perfectly.

how to add mobile number or user contact or phone number