- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 01:18 PM
Help requested
How to remove (empty) user from sys_user_has role.list?
we recently cloned from prod to sub instance dev and in sys_user_has_role.list found empty(25) records.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:59 AM
without doing any changes in ACL the only option is , use background script to update it to false. eg:
var gr = new GlideRecord('sys_user_has_role');
gr.addEncodedQuery('user=22d0ed7fdb08b300798979e49f961977');
gr.query();
while(gr.next()){
gr.inherited=false;
gr.setWorkflow(false);
gr.update();
}
Now you will able to see the delete button on that record as well list , but on list name will be like "Remove user access from table"
Screenshot for reference.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 09:47 AM
can you open any one of the record and right click on header >> show xml >> you will see "User" field in xml , are you seeing sys_id there or empty ? if you are seeing sys_id then might be possible that user record get deleted in your instance.
generally when you add user to role entry get generated in sys_user_has_role table. ootb user column is mandatory .
to delete you can refer below thread, which has mentioned sample code to deleted record from sys_user_has_role table. hope it will help you. let me know if you need any further help here.
Delete orphan records from sys_user_has_role table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 10:11 AM
Hi Harshvardhan,
Thanks for the reply,
yes when i open record i can see the sys_id but not able find the option to delete manually. checked the orphan record post but that code didn't work as expected.
checked the ACL rules for user roles permission. everything looks good.
my final goal is to i don't want to see empty user records in user roles.
Thanks,
Srinivas

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 10:14 AM
are you not able to see "Delete" button on form when you opened it ? what role you have ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 10:27 AM
I have admin role and even am elevated as security admin, it didn't give me option inheritance to false and delete.