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(r) {
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