- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 05:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 05:47 AM
Hi Raghu,
How about something like this... Note this is not tested... Always backup your data (e.g. export the sys_user_grmember table to XML) before testing with the deleteRecord operation.
(function () {
var gm = new GlideRecord('sys_user_grmember');
gm.addQuery('user.active', false);
gm.query();
while (gm.next()) {
gm.deleteRecord();
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 08:22 AM
you mean to say remove users if they are no more active in service now, this is good idea but we are not removing user if he is inactive in service now we just inactivate them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 08:32 AM
Raghu,
I think what Chuck and Robbie were suggesting is that you create an after business rule, the conditions of which are the user is inactivating (however that process occurs). There you would remove the sys_user_grmember (Group membership table) records. This has the benefit of removing them from groups immediately after being inactivated, as opposed to waiting on a scheduled job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 08:44 AM
oh my mistake taken that in wrong direction, but another twist in my requirement is I need to do this if user is till inactive still 28 day. means if user is inactive for 28 days remove him from all the group

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 08:54 AM
Hi Raghu,
You can write a workflow , when a user is made inactive you can trigger this workflow keep a timer for 28 days, after 28 days check if user is still inactive then remove from all the groups. And for sys_user table you can make them locked out once they get in-active and mention userid as Userid-Disabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 09:01 AM
Hi Chuck,
What is your suggestion on this requirement need to remove users from group if he is inactive more that 28 days. what is you recommendation business rule, workflow or schedule job.