We need to remove user subscription from the sys_user_set

NagaNandini N
Tera Guru

Hi Team,

 

We need to remove subscription for the inactive users from sys_user_set table list. Under thed RR user subscription. Please let me know how to remove inactive users via code. Please help me on this. Please find the below screenshot for reference 

2 REPLIES 2

Dr Atul G- LNG
Tera Patron

https://www.servicenow.com/community/sysadmin-forum/how-to-remove-user-from-a-subscription/m-p/34804...

****************************************************************************************
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
******************************************************************************************

Abhishek Pal
Giga Guru

Hi @NagaNandini N ,

I would not recommend deleting users directly from sys_user_set through a script.

The RR_User Subscription record is condition-based, so the correct approach is to exclude inactive users in the user-set condition itself.

Open:

RR_User Subscription

Then update the Conditions to include:

Active is true

AND

your existing role conditions.

For example:

Active is true
AND
(
Roles is itil
OR
Roles is asset
OR
Roles is <other required role>
)

This ensures that only active users qualify for the subscription user set. Once a user becomes inactive, the user will no longer match the subscription condition.

So instead of writing a Scheduled Job or GlideRecord script to delete subscription users, control membership through the Subscription User Set condition.

Also verify that the OR conditions are grouped correctly, otherwise Active = true may not apply to every role condition.

I would avoid directly deleting records from subscription/licensing tables because those records are managed by Subscription Management and direct manipulation can cause incorrect licensing data.

If you are on a newer ServiceNow release where Subscription User Sets have been converted to Groups, then update the corresponding group membership/licensing design instead of modifying the legacy sys_user_set records.

Hope this helps!

If this response helped, please mark it as Helpful.
If it resolves your issue, please Accept it as Solution.

Kind Regards,
Abhishek Pal