how do remove roles which are inherited from group

VaibhavM
Tera Contributor

In users profile , Roles are inherited from the groups. But when I removed group from users profile then roles are not getting removed from users profile . They still exists in users profile and now I am not able to remove them manually as they are inherited from group. How to deal with this issue. I have tried using below script as well to remove roles but its now working for me

var gr = new GlideRecord('sys_user_has_role');
gr.addQuery('user','sys_id of the user');
gr.query();
while(gr.next())
{ gr.deleteRecord(); }