Any suggestion on Script to move an email from outbox to sent?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2023 09:53 PM
Hello experts,
I am still not very confident on my scripting ability, does anyone of you have any advise on how to move na email from outbox to sent in mailboxes using a background script?
I tried to apply the following script:
var outboxEmails = new GlideRecord('sys_email');
outboxEmails.addQuery('mailbox', 'outbox');
outboxEmails.addQuery('type', 'send-failed');
outboxEmails.query();
//Go trhough the email in outbox with all the type 'sent'
while(outboxEmails.next()) {
outboxEmails.mailbox = 'sent'
outboxEmails.update();
}
But it seems that is not really updating to sent.
Regards,
Vaine
Regards,
Vaine
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2023 11:07 PM
Hi @Rain Vaine
Can you please try with below JavaScript code :
var outboxEmails = new GlideRecord('sys_email');
outboxEmails.addQuery('mailbox=failed^type=send-failed');
outboxEmails.query();
while(outboxEmails.next()) {
outboxEmails.type = 'send-ready'
outboxEmails.update();
}
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.