- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 04:00 PM
On our DEV instance we have a whole bunch of emails that are waiting to be sent. How can I delete them so the email queue is empty?
Please be detailed - I am not a scripter so will likely need clear directions if scripting is the answer.
thanks in advance,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 04:19 PM
Hi Tim,
Something like below should work. Elevate your privileges and execute below script from background.
var gr=new GlideRecord('sys_email');
gr.addQuery('type','send-ready');
gr.deleteMultiple();
Thanks
Srinivas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 04:19 PM
Hi Tim,
Something like below should work. Elevate your privileges and execute below script from background.
var gr=new GlideRecord('sys_email');
gr.addQuery('type','send-ready');
gr.deleteMultiple();
Thanks
Srinivas

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 07:59 PM
Hi Tim,
Also please note that you can use gr.setWorkflow(false) statement in case you want to disable the trigger of BR/notification on target table.
NOTE : Background Scripts are so powerful you can wreck your ServiceNow system with the right script. You need to be extra careful in running background scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2016 08:11 PM
You can also change the type to send-ignored rather than deleting those.