User Deactivate from user table after 90 days

Hari Babu
Mega Expert

Hi Team ,

when user is not using service now Account after 90 Days , the account will be deactivate from service now  and also trigger the notification   .

so,i was stuck in Scheduled jobs  user is deactivate  form  user table but notification is not trigger .please look in below  script .

1.Written Notification

2.Event Registry

var user = new GlideRecord('sys_user');

user.addEncodedQuery("active=true^last_login<=javascript:gs.beginningOfLast90Days()");

//user.addEncodedQuery("active!=false^name=user, test");
user.query();
while(user.next())
{
gs.eventQueue("logout_user_90days",user,user.email);

user.active = 'false';
user.locked_out = 'true';
user.update();

}

1 ACCEPTED SOLUTION

reginabautista
Kilo Sage
Try changing the parameter to below gs.eventQueue("logout_user_90days",user,user.sys_id);

View solution in original post

12 REPLIES 12

Hi Haribabu,

Did you get the notification triggered for inactive user?

No Not yet .

Can you help on that . 

I have asked since you have marked this question already as accepted answer.

Check my earlier comment where i have given the suggestion and why the notification might not be coming.

Mark the comment as helpful and correct answer if it answers your question.