Hi,
I’m working on a Client script that will automatically select the right employee from the frappe.session.user.
I tried different things but I’m not sure what is the right way to do that.
I think I need to make a frappe.call to get employee list and then filter with the user_id which is the email login.
But to make a frappe.get_list I need to whitelist and I’m a bit lost with that.
Is there another simple way to do that in the client script?
I mean I could do a simple switch statement and manually setting the employee but it’s not a really nice way to do it…
I have created a custom data field type on the DocType Quotation “full_name” to store the employee name who created the quotation.
Then I created a client-side script and a variable on my on this script called value_name to store the employee name from frappe.db.get_value and set the value of this variable in the field full_name as shown:
frappe.ui.form.on(‘Quotation’, {
refresh(frm) {
// your code here
var value_name = frappe.db.get_value(“Employee”, {“user_id”: frappe.session.user}, [‘employee_name’]);
cur_frm.set_value(‘full_name’, value_name);
}
})
but the output I am getting this instead of the employee name: