- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 09:40 AM
Hi Friends,
I have created the following Scheduled Job to run daily to find out who has not login for 91 days and send them the email notification. It is not working. I would appreciate if you can help me on this.
Regards,
Hong
_______________________________________________________
_______________________________________________
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 02:30 PM
Run something like this as a Fix Script to see the results vs what is expected, then adjust the numbers if needed before disabling the print line and uncommenting the eventQueue for your scheduled script. In a PDI or non-prod instance you should be able to update Last login in a list view to test the results.
var userGr = new GlideRecord('sys_user');
userGr.addEncodedQuery('last_login!=NULL^last_loginRELATIVELT@dayofweek@ago@89^ last_loginRELATIVEGT@dayofweek@ago@91');
userGr.query();
while (userGr.next()) {
gs.print(userGr.name); //temporary for troubleshooting
//gs.eventQueue('user.account.deactivated', gr, '');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 06:30 AM
Hi Kilo,
I made a small change and it works - Thanks
var usr = new GlideRecord('sys_user'); usr.addNotNullQuery('last_login') usr.addEncodedQuery('active=true^u_account_request_numberISNOTEMPTY^last_loginRELATIVELT@dayofweek@ahead@90^last_loginRELATIVEGT@dayofweek@ago@92'); usr.query(); while (usr.next()) { gs.eventQueue('user.account.deactivated', usr, ''); } |