Not able to delete empty role references from sys_user_has_role table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 05:27 AM
In the sys_user_has_role table (User Roles) which contain rows of empty role references while we neither have (empty) role in sys_user_role table nor within any assignment group. So as per the analysis if we want to delete the empty role references from sys_user_has_role if it is not needed but looks like there is some OOTB restrictions to delete those empty references. Please suggest in this case how we can do this clean up for empty role references from sys_user_has_role table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 05:35 AM
@Parveen28 Do you get any errors when you try to delete such records?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 07:48 AM
Hi Sandeep,
Upon executing the script some records has been deleted but with the rest of the records same script is not working and UI Action on selected row is also disabled.
Thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2024 03:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 07:56 AM
Hi @Parveen28 ,
The challenge here is that the roles are inherited. So you can't delete them directly through a script as well.
You first need to set inherited as 'false' and then perform the delete action using a background script.
You can do both in the same script execution.
Refer below:
Please mark this as helpful/correct for others to benefit from this.