Emails from a scheduled job getting deleted from logs after 30 minutes

snow_beginner
Mega Guru

Hi, there is a scheduled job that runs daily at 7 am and sends an email out to some people. It seems to be running fine and sends out the email to the relevant people but the logs/sent emails are getting deleted after 30 minutes. What could be causing this issue?

 

I have checked the Archive destroy rules and there is only one on sys_email table and thats set to destroy emails after 366 days. 

There are no business rules as such on the sys_email table which would cause this.

 

The scheduled job is conditional

var answer = false;
var dayCheck = new lbgDateUtils;
var dayOfWeek = dayCheck.checkDay();
if (dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 4 || dayOfWeek == 5) {
    answer = true;
}

Thanks

 

4 REPLIES 4

Sumanth16
Kilo Patron

Hi @snow_beginner ,

 

Hello,

 

As per ServiceNow documentation:-

 

Sumanth16_0-1710857763946.png

 

 

So now the above is true for OOB configuration. You will have to check the configuration on your instance. For that go to Archive rules and Archive destroy rules:-

 

Sumanth16_1-1710857763943.png

 

 

 

And then check for sys_email:-

 

Sumanth16_2-1710857763959.png

 

 

There you will find the condition which you can change if required:-

 

Sumanth16_3-1710857763951.png

 

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

d_17
Tera Expert

Hi @snow_beginner ,

 

Try to inactivate and check if it's causing issue still. if not then check any other schedule job written on sys_email

Hi @d_17 the issue is only happening with this scheduled job report. I think a HI case will be needed as I couldn't find anything which may have caused this. 

Maddysunil
Kilo Sage

@snow_beginner 

ServiceNow includes functionality to automatically clean up sent notifications after a certain period. Even though there's no explicit business rule on the sys_email table, there might be a system setting or plugin configured to delete sent emails after a certain timeframe. Check the system properties or plugins related to notifications to see if there's any configuration affecting the cleanup of sent emails.

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks