group member inactive

keerthi35
Tera Contributor
Group manager should be notified when any group member becomes inactive
10 REPLIES 10

Harsh_Deep
Giga Sage
Giga Sage

Hello @keerthi35 

 

You can create a Notification on the sys_user table and condition active changes to false and set the subject and mail body.

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

Aman Kumar S
Kilo Patron

Hi @keerthi35 

Help me with a query, suppose a user is deactivated and if user is member of 30 40 groups, all of the group managers should be informed.

If that's the case, you might want to reconsider this since it will result in triggering so many emails.

Better approach would be to build a report and share with the group managers and let them monitor it if there is an inactive user in the group.

 

If you still want to pursue the requirement, you will need to write a BR on the sys_user table and find the user's group by gliding the sys_user_grmember table and get the group's manager, create an event and trigger that using gs.eventQueue(), to launch a notification

 

Best Regards
Aman Kumar

HI @Aman Kumar S 

 

I will try BR

 

Thanks.

hello @Aman Kumar S 

 

i am writing this code but didn't get answer

 

 

var gr = new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('active=true^member.active=false');
gr.query();
while(gr.next()){
var groupManagerEmailIds = '';
var gruserManagerEmail = new GlideRecord('sys_user_group');
gruserManagerEmail.adddQuery('group', gr.sys_id);
gruserManagerEmail.query();
while(gruserManagerEmail.next())
{
groupManagerEmailIds+ ',' + gruserManagerEmail.user.email;
}
gs.eventQueue("member.left",gr,groupManagerEmailIds,"");
}