Get Logged In User's Email ID

Hi , how do we get email id of logged in user inside frappe framework.


Get logged in user id,

on js side use user
on python side frappe.session.user


You can get current logged in user at js side using user and at python side frappe.session.user

Thanks, Priya

Is there any way to get email of the user using the user id ?

Never Mind , I fixed it by creating custom function in utils (frappe/frappe/utils/

def get_email(user=None):
	p = frappe.db.get_value("User", user, ["email"], as_dict=True)
	return p 

example using it : frappe.utils.get_email(frappe.session.user);

@srajelli, Actually when you use frappe.session.user then you get current logged in user and this is email_id of that user, so not need to use get_value method again.

Thanks, Priya

1 Like

I tried using frappe.session.user but username was returned rather than email_id. Just for the record I am actually using an older version of frappe

How can we get User full name from session??

1 Like

I need this too. You found a solution?

EDIT: Is there a way to prefill a doctype with values, which we can not get by Customize Form?

I tried to add the full_name of the current user to a custom field, but I couldn’t get it work by Customize Form. By JavaScript/jQuery, I would need a seperate AJAX request, just to get the full user name, as following:

#client side in mycustomdoctype.js{
			method: "mycustomapp.utils.get_full_user_name",
			args: {"user": frappe.session.user },
			callback: function(r) {
				if(r.message) {
					frm.set_value("current_user", r.message)

#server side

def get_full_user_name(user=None):
	p = frappe.db.get_value("User", user, "full_name")
	return p

As this may be useful for someone, I like to post it here, but as I wrote, it it a separate AJAX request, for a very basic information.

Is there a way to solve it server side?

EDIT: For a client side solution, use sione solution below:

(we are still searching for a server side solution, without the need of a separate AJAX request)

1 Like

This is what I used to get the user fullname

var Current_User = user;{
	args: {
		filters: {'email': Current_User
	callback: function(r) {
		cur_frm.set_value("User_Full_Name", r.message["full_name"]);
1 Like

Good solution! Better than mine. It reduces the need of custom server side scription.

@sione, @ci2016,

To get the logged in User’s fullname you can use the frappe.user.full_name(uid) in custom script directly no need to use the to fetch the user_info as it is already available.



Thanks a lot…much easier solution

Thank you. Where does uid come from?

Reference Error: uid is not defined


uid is the user’s email id, you can get the uid from frappe.session.user variable


Excuse me:

i need to add custom filed in quotation
name it

Quotation By
and this filed take its data from the current login user

For example if the login user is
so when this user make a quotation
the filed will automatically take its name
as the one who made this quotation
how can i achieve this ?

best regards .

I would find this useful too

Its already there u can check the owner field in the db.


also create a int field called valdone so you don’t keep overwriting every time you save

	validate: function(frm) {
			if(cur_frm.doc.valdone !== 1 ){{
			method: "frappe.client.get",
			args: {
				doctype: "User",
				filters: {"email":user}    
			callback: function(r) {
					frm.set_value("quotation_by", r.message.full_name);		
					frm.set_value("valdone", 1);					
1 Like

@Julian_Robbins @ kindly check my answer