Streamlining Employee Departures: How to Safely Disable User IDs in ERPNext

by | Sep 6, 2023 | ERPNEXT, Frappe Framework | 0 comments

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

By Aadhil PM

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *