About the examples: Examples and screenshots in this guide use BEAT, a demo company in a Dynamics 365 test environment. Use your own company's codes and values instead of copying them.
When to run it
When to run it
Once order email notifications are running and the email notification logs keep growing; set it up together with the email notification job.
How often
Recurring with no end date; Learn's example runs it every three months.
Batch settings
A recurring batch job with no end date. Each run keeps creating subtasks of up to 2,000 logs each until no qualifying logs are left.
What the output shows
Fewer email notification log records: logs older than Retention days are gone, and so are unsent emails when that option is Yes. If old entries remain, they are usually unsent emails kept because Also delete unsent emails is No.
Go to Retail and Commerce > Retail and Commerce IT > Email and notifications > Clean up email notification logs.
In Retention days, enter how many days email logs are kept. The job deletes only emails older than that.
Set Also delete unsent emails to Yes if emails that weren't sent successfully should be deleted too; leave it No to keep them in the log.
Select Recurrence and set the pattern, for example Months with Count 3 to clean up every three months, and select No end date to keep the job running.
If each subtask should delete more or fewer than 2,000 logs, change NotificationLog_NumOfRowsToBeCleaned in Commerce shared parameters > Configuration parameters.
After a run, open the email notification logs and check that no entries older than the retention days are left (apart from unsent emails, if you kept them).