Skip to content

Commit d0d58d0

Browse files
authored
Create script.js
1 parent 7cf9aaf commit d0d58d0

File tree

1 file changed

+12
-0
lines changed
  • Background Scripts/Notify User of Password Expiry

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var userGR = new GlideRecord('sys_user');
2+
userGR.query();
3+
while (userGR.next()) {
4+
var expiryDate = new GlideDateTime(userGR.password_needs_reset_by);
5+
var today = new GlideDateTime();
6+
var diff = GlideDateTime.subtract(expiryDate, today);
7+
8+
// Check the difference in days
9+
if (diff.getDays() < 7) {
10+
gs.eventQueue('password_expiry', userGR, 'Your password will expire in ' + diff.getDays() + ' days.', '');
11+
}
12+
}

0 commit comments

Comments
 (0)