group member inactive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2023 09:32 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2023 10:42 PM - edited ‎11-28-2023 12:03 AM
Hi @keerthi35
Hope you are using after BR on the sys_user table and keeping the condition as active changes to false
Change your code:
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery("user", current.getUniqueValue());
gr.query();
var grpManagers = [];
while(gr.next()){
if(grpManagers.indexOf(gr.group.manager.toString()) >-1){
grpManagers.push(gr.group.manager.toString());
}
}
gs.eventQueue("member.left",gr,grpManagers.toString(),"");
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2023 10:08 PM
Create a after BR on table sys_user table that should be triggered when user becomes inactive
var userGroup = new GlideRecord('sys_user_grmember');
userGroup .addQuery('user',current.getDisplayValue('sys_id');
userGroup .query();
while(userGroup .next()){
gs.eventQueue('eventname','userGroup'); //trigger an event which sends a Notification to the users manager
}
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2023 10:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2023 10:41 PM
System Policy -> Events -> Registry
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2023 11:12 PM
HI @keerthi35 ,
I trust you are doin great.
- Create a new Business Rule that triggers on updates to the
User
(sys_user) table. - Set the condition to check if the user's
active
field has been changed to false (inactive). - In the script, identify the groups to which the user belongs and find the managers of those groups.
(function executeRule(current, previous /*null when async*/) { // Check if the user has been set to inactive if (current.active == false && previous.active == true) { // Query to find groups where the user is a member var grMember = new GlideRecord('sys_user_grmember'); grMember.addQuery('user', current.sys_id); grMember.query(); while (grMember.next()) { // Find the manager of the group var grGroup = new GlideRecord('sys_user_group'); if (grGroup.get(grMember.group)) { var managerSysId = grGroup.manager; // Send notification to the manager gs.eventQueue("your_custom_event", current, current.user_name, managerSysId); } } } })(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi