Get fullname of doc.owner and doc.modified_by

Good Day! I was trying to fetch the owner of the document and the one who submitted it. I was able to fetch it however it only fetch the email instead of the full name.

I also tried var owner = frappe.get_fullname(doc.owner) but it doesn’t work. Hope you could help me for I’ve been searching for days and find no solution to this.

Here’s the custom script:

frappe.ui.form.on(“Material Request”, “validate”, function(frm) {

if (frm.doc.workflow_state == “Pending Request”)
{
frm.set_value(“prepared_by”, frm.doc.owner);
}

else if (frm.doc.workflow_state == “Pending Approval”)
{
frm.set_value(“noted_by”, frm.doc.modified_by);
}

else if (frm.doc.workflow_state == “Approved”)
{
frm.set_value(“approved_by”, frm.doc.modified_by);
}
});

1 Like
frappe.call({
			method: "frappe.client.get_value",
			async:false,
			args:{
				doctype:'User',
				filters:{
					name:frm.doc.owner
				},
				fieldname:['full_name']
			},
			callback:function (r) {
				if(r.message != undefined){
					console.log(r.message.full_name)
				}
			}
		});

by the above script, you can able fetch Full name of the owner.
I am attaching ScreenShot of the output of the Script.
Screenshot%20from%202019-07-05%2017-17-05

3 Likes

THANK YOU SO MUCH! This helps us a lot! :smiley:

1 Like