Need To Fetch Designation in Quotation Print Format

Dear Community,
In Quotation Doctype, I had one Field called custom_quotation_created_by, it fetch name who that quotation is created.Here custom_quotation_created_by is come like email id. But in Print Format i need their name not as ID also i need their Designation Rnw i had code for Full name and Designation but the issue is Designation come Constant for all employees.

My Code:

For {{doc.company}}




{% if doc.custom_quotation_created_by %} {% set user = frappe.get_doc("User", doc.custom_quotation_created_by) %} {{ user.full_name }} {% endif %}


{% if doc.custom_quotation_created_by %} {% set employee = frappe.get_doc("Employee", doc.employee) %} {{ employee.designation }} {% endif %}

Also i tried this code,but designation Not visible.

{% if doc.employee%} {% set employee = frappe.get_doc("Employee", doc.employee) %} {{ employee.designation }} {% endif %}

Print Output:
image
Nishad is Manager but it shows Divisional Manager as Constant in Print format.

If custom_quotation_created_by is Nishad@ABC.IN means the code give that Full Name as Nishad but facing same designation error coming for all Employee.
pls help to resolve this Issue.

Hi @Mohamed2335,

If the user link with an employee then please apply it.

{% if doc.custom_quotation_created_by %}
    {% set user_id = frappe.db.get_value("User", doc.custom_quotation_created_by, 'name') %}
    {% if user_id %}
        {% set designation = frappe.db.get_value("Employee", {"user_id": user_id}, 'designation') %}
        {% if designation %}
            {{ designation }}
        {% endif %}
    {% endif %}
{% endif %}
2 Likes

Thanks for your Response,Its Works