AshishKM
Kilo Patron

Hi @jaubert , 

Please follow as suggested by @Mark Manders  and @Community Alums 

 

Use below updated code as shared by @Community Alums .

 

var grSysEmail = new GlideRecord('sys_email');
grSysEmail.addEncodedQuery("mailbox=outbox^state=ready");
grSysEmail.query();
grSysEmail.setWorkflow(false);
grSysEmail.deleteMultiple(); // deleteMultiple doesn't required result set iteration

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution