Add active user fullname in WEB FORM

Hi there,
I have a big answer for me pls.
Haw can I get the current user fullname, if logged in, captured into a field from a webform, pretty please???

I looked all around and found the following and more, but nothing worked for Web Forms:

- first try (I used this in Client Script from Web Form Doctype)
frappe.ui.form.on(“Customer”, “first_name”, function(frm) {
frm.set_value(“customer_name”, strip(frm.doc.first_name + " " + frm.doc.last_name));
});

- second try (I used this in Custom Scripts)
frappe.ui.form.on(‘Web Form’, {
refresh(frm) {
// your code here
var Current_User = user;
frappe.call({
method:“frappe.client.get”,
args: {
doctype:“User”,
filters: {‘email’: Current_User
},
},
callback: function® {
cur_frm.set_value(“full_name”, r.message[“full_name”]);
cur_frm.set_value(“email”, r.message[“email”]);
cur_frm.set_value(“phone_number”, r.message[“phone”]);
}
})
}
})

None of the above worked! What am I doing wrong, pls?
TIA

frappe.user.full_name()

Would get the currently logged in user’s full name.

1 Like

Hi! I try in the **Client Script from Web Form like this and it is not working, do you know what could be wrong? (usuario is a fieldname link type on the web form)

frappe.web_form.after_load = () => {

var nombre_usuario = frappe.user.full_name()
frappe.web_form.set_value("usuario", nombre_usuario );

};

Thanks!!!