How to get inactive members in each group and an email should trigger to individual manager

shabbir5
Tera Guru

Hi All,

 

I am working on a requirement to get inactive members in each group and to send an email to managers with the inactive user details in their group

 

--> i am trying with below code :

 

var gr=new GlideAggregate('sys_user_grmember');
gr.addQuery('user.active',false);
gr.addQuery('manager.active',true);
gr.groupBy('group');
gr.query();
while(gr.next())
{
    gs.log(gr.group.name+':::'+gr.group.manager.user_name);
}
 
I am getting the groups and managers list with this , but not getting how to send email to these managers with inactive user details ??
 
this should trigger every 6 months , so i am trying this code in a schedule job
 
please help how to send inactive user details in the email , i have event and notification already .
 
@Ankur Bawiskar  please provide your inputs
 
Thank you,
Shabbir Shaik
6 REPLIES 6

Amit Verma
Kilo Patron

Hi @shabbir5 

 

Flow will be an alternate no-code and efficient way to handle this requirement as suggested by @Mark Manders . Please give it a try and let us know if you face any issues,

 

Thanks and Regards

Amit Verma

Thanks and Regards
Amit Verma

Ankur Bawiskar
Tera Patron

@shabbir5 

I agree with Mark here.

Please share the status once you try that flow option

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader