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-26-2024 02:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 05:45 AM - edited 09-26-2024 05:46 AM
Hello @Gangadhar Ravi
As mentioned before I did try this instead of role I gave group and it worked. But it's only deleting the records when we update it like new user who was active before if we inactivate it it is working but the existing records which are there previously is not deleting. That's why I want to write BR in group member.
Thanks & Regards,
I Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 02:53 AM - edited 09-26-2024 03:03 AM
Hi @I_Das
I believe it’s best to write a "BR" entry in the user table. This is important because if we mark a user record as inactive, the "BR" process will run and remove the user from the group.
Create BR on User Table
Condition
active is false
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', current.sys_id);
gr.query();
while (gr.next()) {
gr.deleteRecord();
}
Please mark this response as Correct and Helpful if it helps you can mark more that one reply as accepted solution
Thanks
Eshwar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 05:38 AM
Hello @Eshwar Reddy ,
I did try and it worked. But it's only deleting the records when we update it like new user who was active before if we inactivate it it is working but the existing records which are there previously is not deleting. That's why I want to write BR in group member.
Thanks & Regards,
I Das