Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This Scheduled Script Execution in ServiceNow is designed to automatically reset the bounced_email_count for active users who have exceeded a threshold.
It helps maintain email hygiene and ensures that users with high bounce rates are flagged and reset for further investigation or remediation.


Purpose
To identify active users with a bounced_email_count greater than 8 and reset their state and count to allow for reprocessing or follow-up.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1646657
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

var blockedGR = new GlideRecord('sys_blocked_email_address');
blockedGR.addQuery('fail_count', '>', 8);
blockedGR.query();

while (blockedGR.next()) {
var userGR = new GlideRecord('sys_user');
userGR.addQuery('email', blockedGR.email_address);
userGR.addQuery('active', true);
userGR.query();

if (userGR.next()) {
// Update user record
userGR.state = 'new';
userGR.update();

// Reset fail_count on blocked email record
blockedGR.fail_count = 0;
blockedGR.update();
}
}
Loading