Hi,
I want to disable user through Custom script.
Please Help!
Thank You
Hi,
I want to disable user through Custom script.
Please Help!
Thank You
Please Help!
Create a button, and in function add this statement. It should probably work:
Suppose you are in Employee document then in that function, execute this statement.
frappe.db.set_value("User", cur_frm.doc.user_id, "enabled", 0)
Also check that userâs role, make this button visible only for users with Roles like âSystem Managerâ or HR Admin or similar.
This should work. Button examples are available in plenty.
using below script
frappe.db.set_value(âUserâ, cur_frm.doc.email, âenabledâ, 0)
thatâs worked
Thank you
But also check the userâs role before allowing this button. Donât allow random people disabling users. I donât think it will happen this easily but still do it as an extra security measure.
No I mean check the role of the person who is logged in. Add a statement to check the logged in userâs role say allow only users with System Manager role or HR Admin role to view this button.
Yes @root13F
I have given to permission for that particular button and allows only one user to press that button.
Thank You