Deleting inactive users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 02:46 AM
Hello all,
I want to remove inactive users from assignment group, I want to write a business rule on group member table.
When: before
Script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 05:51 AM
Hello @dhanrajb ,
Thank you for the reply. I had done it with background script It worked. I just wanted to know if BR will be possible with existing user. I got that it's not possible.
Thanks & Regards,
I Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 06:20 AM - edited 09-26-2024 06:32 AM
Hello @I_Das ,
please check with this background script:
var groupMembers = new GlideRecord('sys_user_grmember'); // Group Members table
groupMembers.query();
while (groupMembers.next()) {
var user = new GlideRecord('sys_user');
if (user.get(groupMembers.user) && !user.active) {
groupMembers.deleteRecord(); // Remove inactive user from the group
}
}
If you still want to use the business rule, you’ll need to ensure that it gets triggered for the existing inactive users. One way to do this is to trigger an update on the "sys_user_grmember" records to re-evaluate them, but this would only work on records that are being updated.
You can combine the business rule with a scheduled job for proactive cleanup and batch processing for older records.
Thanks & Regards,
SK6147
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 05:51 AM
Hello @Sai Krishna6147
Thank you for the reply. I had done it with background script It worked. I just wanted to know if BR will be possible with existing user. I got that it's not possible.
Thanks & Regards,
I Das