I have a field called Approver. Its linked to User. But its listing all the users. But i need to list the users who have particular role profile name. i have done the below code. But its not working. Please help me regarding this.
frm.set_query("approver", function() {
return {
filters: [
['User', 'role_profile_name', '=', 'Employee']
]
}
});
Try this
cur_frm.fields_dict[‘approver’].get_query = function(doc, cdt, cdn) {
return {
filters: [
[‘Has Role’,‘role’, ‘=’, ‘Employee’]
]
}
}
Tried this , but its not working
I have done the previous code also. But i am still not able to get the output.
frappe.ui.form.on(‘Employee Registration’, {
// refresh: function(frm) {
refresh: function(frm) {
this.frm.fields_dict.approver.get_query = function(doc, cdt, cdn) {
return {
query: “empreg.employee_reg.doctype.employee_registration.employee_registration.employee_user”,
filters: {ignore_user_type: 1}
}
}
},
});
Can anyone please help me for this topic.
Try this one:
write on refresh trigger:
frm.set_query(“approver”, function(doc) {
return {
“filters”: {
“user_field_name”: doc.user_field_name,
}
};
});
This code is also not working