- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2015 08:48 AM
I was working on something which created 15000 emails yesterday. They are sitting in the email log in ready to sent state. I turned off the email notifications to stop sending them. I need a background script to delete all the mails that were created yesterday. Its kind of urgent!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2015 09:56 AM
- Do a gliderecord query on sys_email table and filter the records on the table.
- Copy query and use encoded query to pick only emails that are needed.
- Update the state of the records to 'ignored'.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2015 09:56 AM
- Do a gliderecord query on sys_email table and filter the records on the table.
- Copy query and use encoded query to pick only emails that are needed.
- Update the state of the records to 'ignored'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2015 10:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2015 10:39 AM
or:
var email = new GlideRecord('sys_email');
email.addEncodedQuery('sys_created_onONYesterday@javascript:gs.daysAgoStart(1)@javascript:gs.daysAgoEnd(1)');
email.query();
while(email.next()){
email.deleteRecord();
}
or:
var mu = new GlideMultipleUpdate('sys_email');
mu.addEncodedQuery('sys_created_onONYesterday@javascript:gs.daysAgoStart(1)@javascript:gs.daysAgoEnd(1)^type=send-ready');
mu.setValue('type', 'send-ignored');
mu.execute();