- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 11:11 AM
Hi Team,
I have an issue with deleting orphan records from sys_user_has_role table.
Tried with fix script to delete these records using GlideRecord, failed.
Delete button is disabled, even though schema level deletion is enable.
Also dried to deleted the user and imported the same user record using XML (user record export). Still role definitions are there!
Is there any method to delete these records from the above table?
Any suggestion please?
Platform is on Helsinki Patch 8.
Thanks & Regards,
Gee Abraham
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2017 06:47 AM
Hi All,
This issue has been resolved by installing the following plugin.
Contextual Security: Role Management Enhancements (com.glide.role_management.inh_count)
Many thanks for your efforts to resolve this issue.
Best Regards,
Gee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 11:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 11:26 AM
Please share your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 01:51 PM
Hi Pradeep,
Here is the script that I have executed. Thanks, Gee.
----
var usr = new GlideAggregate("sys_user_has_role");
usr.addQuery("user", "7225d7164f03a2007b3be6518110c792");
usr.query();
while(usr.next())
{
usr.deleteRecord();
usr.update();
gs.log('********* sys_user_has_role ' + usr.role.name + ' ' + usr.granted_by);
}
----

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 01:56 PM
Hello Gee,
Replace
usr.deleteRecord();
usr.update(); with
usr.setWorkflow(false);
usr.deleteMultiple();
P.S : Try this on dev instance first