- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2015 09:44 AM
When a user goes inactive we need to check if that user was a manager of a group or if that user was a member of a group. If the user is a member of a group we will remove them from that group. If they were a manager of that group we need to replace that user with their manager and notify the manager that they have been assigned the group manager.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2015 10:48 AM
A business rule on sys_user that says:
before Insert
condition current.active.changesTo('false')
var group = new GlideRecord('sys_user_group');
group.addQuery('manager', current.sys_id);
group.query();
while(group.next()){
group.manager = current.manager;
group.update();
gs.eventQueue('group.manager.changed', group, group.manager, current.name);
}
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('user', current.sys_id);
grmember.query();
while(grmember.next()){
grmember.deleteRecord();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2016 05:41 AM
Hi Mike,
I have a question which is similar to this type. Please go through the below mail thread.
https://community.servicenow.com/thread/212956
Thanks
Shrikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 06:53 AM
Hi,
Running into similar issue however is there a way to validate the user was inactive for 30 days prior to the business rule run?
Reason being if someone gets locked out with synced accounts this will make the user appear inactive in servicenow however they are just having a PW reset issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2018 02:16 PM
Hi Jo, You may also want to consider last login time or updated time stamp in sys_user table if you are getting your daily feed from ADS.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2019 10:42 AM
Hi. We have a similar requirement, but we want to wait 24 hours after they have been inactivated before removing them from the group. What is the best way to do that? I like the idea of the business rule, but can it run based on that 24 hours requirement? Other suggestions have been to use a scheduled job or workflow. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2019 12:59 PM
I would have a scheduled job that runs every night, finds all the inactive users that have been inactive for greater than 24 hours, then run the job to do what you need.