Skip to content

Commit e3a5e75

Browse files
authored
Create script.js
1 parent 69c730d commit e3a5e75

File tree

1 file changed

+21
-0
lines changed
  • Server-Side Components/Scheduled Jobs/Unblock bounced email address

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
var blockedGR = new GlideRecord('sys_blocked_email_address');
3+
blockedGR.addQuery('fail_count', '>', 8);
4+
blockedGR.query();
5+
6+
while (blockedGR.next()) {
7+
var userGR = new GlideRecord('sys_user');
8+
userGR.addQuery('email', blockedGR.email_address);
9+
userGR.addQuery('active', true);
10+
userGR.query();
11+
12+
if (userGR.next()) {
13+
// Update user record
14+
userGR.state = 'new';
15+
userGR.update();
16+
17+
// Reset fail_count on blocked email record
18+
blockedGR.fail_count = 0;
19+
blockedGR.update();
20+
}
21+
}

0 commit comments

Comments
 (0)