How to make table field read only for particular role wise

in ‘issue’ doctype i have one table field and wants to read only for ‘tenant’ role
i have used this script but not work
frappe.ui.form.on(‘Issue’, {
onload: function(frm) {
// Check if the current user has the ‘Tenant’ role
if (frappe.user.has_role(‘Tenant’)) {
// Make the table field read-only
frm.set_df_property(‘custom_person_in_charge_technician’, ‘read_only’, 1);
}
}
});

Hi,

Have you seen this thread?