The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Is there a way to reprocess email through scheduled job?

tyroux
Kilo Contributor

I added a new choice field in the sys_email form which has a choice "Pending" and I want to make a scheduled job that will reprocess all email with a "Pending" status.

3 REPLIES 3

snehabinani26
Tera Guru

You can have a schedule job in place which will GlideRecord the sys_email table and then reprocess the emails as per your req.


http://wiki.servicenow.com/index.php?title=Reprocess_Received_Emails#gsc.tab=0


Harsh Vardhan
Giga Patron

Hi Renon,



yes ! it's possible to send notification via scheduled job.



Please refer the blog below.



Fire an email notification from a schedule job



Thanks,


Harshvardhan


Alikutty A
Tera Sage

You can write a scheduled job with the following script to reprocess emails with Pending status.



var gr = new GlideRecord('sys_email');


gr.addQuery('u_status', 'pending'); //u_status should be your new column name and pending should be the actual internal value for choice


gr.query();


while(gr.next()){


gr.mailbox = "outbox";


gr.type = "send-ready";


gr.update();


}



Once you execute the job, all pending emails should be resend to outbox.



Thank You


Please Hit Like, Helpful or Correct depending on the impact of response