How to make a button visible to User with specific role

Hi @Mounananda_Reddy,

Please apply the simple script for it.

frappe.ui.form.on("Interview",{
    refresh: function(frm) {
        setTimeout( () => {
            if (frappe.user.has_role('Placement Officer') == -1) {
                frm.remove_custom_button("Reschedule Interview");
            }
        }, 10);
    }
});

Please set the doctype name and field in the script.

Reference: https://docs.erpnext.com/docs/user/manual/en/restrict-user-based-on-child-record

I hope this helps.

Thank You!

1 Like