- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 03:59 AM
I want to delete emails from the email log from outbox. Not all the mails, only from outbox i want to delete. Can anyone help me out with the background script to delete the emails from the log.
Thank you very much in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:14 AM
You can check this out.
var gr = new GlideRecord('sys_email');
gr.addEncodedQuery('mailbox=outbox');
gr.query();
gr.next();
gr.deleteMultiple();
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 02:58 AM
Table is not sys_email_list, rather main table is "sys_email" only. So data should be deleted from table sys_email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:14 AM
Hi Venkat,
Thank you for your reply. That i can do for 20, 30 records. But in outbox there are morethan 25000 records, i want to delete all the mails from outbox. can you please help me in that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:23 AM
u can use this Bharath
using the back ground script
var gr = new GlideRecord('sys_email');
gr.addEncodedQuery('mailbox=outbox');
gr.setLimit('2500');
gr.query();
while(gr.next()){
gr.deleteMultiple();
gs.log('email deleted');
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:25 AM
You wont need gr.update(); or the while loop if you are using deleteMultiple()