Open utterances-bot opened 1 year ago
Nice one! I implemented something similar in the instance I look after, but added it to a UI Action that's visible on the "Outbox" view.
function showConfirmation() {
if(confirm('This will mark all emails currently in the Outbox as "Send-Ignored". You sure about that?')) {
g_list.action('UI ACTION SYSID', 'ACTION NAME');
} else {
return false;
}
}
if (typeof window == 'undefined'){
clearOutbox();
}
function clearOutbox() {
var rec = new GlideRecord('sys_email');
rec.addQuery('type','send-ready');
rec.query();
while (rec.next()) {
rec.type = 'send-ignored';
// gs.print('Email ' + rec.subject + ' ignored');
rec.update();
}
}
@atomsmasha nice one, that'll save you some time right there!
Quick ServiceNow Code: Clear the outbound email queue
Avoid the headache of accidentally sending out a mountain of old emails by clearing the email queue before enabling "Email sending" on a development instance.
https://davidmac.pro/posts/2021-05-07-stop-outbound-emails/