how can I force reset the passowrd after every 30 days

sunnysunny
Kilo Contributor

Can anyone please explain me in detail , I couldnot followed the wiki .

1 ACCEPTED SOLUTION

Sunny,



var gr = new GlideRecord('sys_user');


//The below query will reset the password for all users whose date of password is dated more than 20 days before.Change accordingly.


gr.addQuery('u_date_of_password','<','gs.daysAgo(-20))');


gr.query();


while (gr.next())


{


    gr.password_needs_reset = true;


    gr.update();


}


View solution in original post

16 REPLIES 16

Sunny,



Here is the business rule


find_real_file.png


find_real_file.png



This should do the needful.


So the date field gets updated when the password changes,   I need help with the coding in the scheduled jobs please?


I would recommend attending our Scripting course (Scripting in ServiceNow ) since this very topic is actually covered in depth there!


Thanks, I will sometime later. Out of my budget right now.


Sunny,



var gr = new GlideRecord('sys_user');


//The below query will reset the password for all users whose date of password is dated more than 20 days before.Change accordingly.


gr.addQuery('u_date_of_password','<','gs.daysAgo(-20))');


gr.query();


while (gr.next())


{


    gr.password_needs_reset = true;


    gr.update();


}