Simplify the process of disabling user IDs in ERPNext when an HR employee departs. Follow our easy steps to safeguard your data and ensure compliance with user access management.
Marking an Employee as LEFT should automatically disable their User ID
Add Custom Script
frappe.ui.form.on(‘YourDocType’, { validate: function(frm) { if (frm.doc.status === ‘Left’) { frappe.call({ method: “frappe.client.set_value”, args: { doctype: “User”, name: frm.doc.user_id, fieldname: “enabled”, value: 0, }, freeze: true, callback: function(r) { if (!r.exc) { frappe.msgprint((“User has been disabled from access.”)); } else { frappe.msgprint((“Error occurred while disabling the user.”)); } } }); } } });
Reference: https://discuss.frappe.io/t/hr-employee-left-should-disable-userid/50037/6
0 Comments