Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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(); }

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@VaibhavM 

see this

Adding / removing role to a group with high number of users does not add / remove role to all the us... 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @VaibhavM 

 

It’s a problem on the SN side. If you look at this, you might get an idea of what’s happening.

 

Workaround

On Madrid or later:

  • Add system property glide.ui.schedule_slushbucket_save_for_group_roles and set to true. This will cause group role additions or removals to be performed in the background, so it will not be immediately visible on the group and will need a refresh to confirm completion.
  • If this works, when using "Edit" on the related list of a user group, you will see an information message at the top: 

     

On a version earlier than Madrid, choose from one of the following workarounds:

  • Increase the quota for UI transactions whenever such a long-running operation is performed by going to https://<instance-name>.service-now.com/sysrule_quota.do?sys_id=88fe39123701200024d1973ebebe5dfd. Increase the value to a large number before running this transaction. The default value is 298 seconds.
  • Write a simple GlideRecord-based script to perform the same action to add the role to the group in Scripts - Background. The background scripts are not subject to the UI transaction quota checks. 

Note that, although the fix for this is with the system property on Madrid, it is not enabled by default on instances.


Related Problem: PRB1180971
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************