Skip to main content What is Dynamics 365? Customer stories Try our products Build your own agents CRM ERP Sales Service Sales Customer Insights Customer Service Contact Center Field Service Supply Chain Management Commerce Finance Project Operations Human Resources Sustainability Business Central Pricing Business application topics Training & certifications Documentation Private equity Migrate to Dynamics 365 Events Dynamics 365 Blog Product updates Onboarding and implementation Community Find a partner Software Development Companies Partner resources Microsoft Marketplace Product documentation Technical support On-premises product support Contact us Try for free Sign in

Discover what’s coming to Microsoft Ignite, Nov 17-20, 2026. Register now.


In previous post the solution was to run batch job Administration > Periodic > Notification clean-up as a part of your maintenance plan. Now we have follow up question: how to set up this batch job to remove messages older than 1 month.

To achieve it we can use static function monthRange (public static str monthRange(int relativeMonthsFrom = 0, int relativeMonthsTo = 0)) of class SysQueryRangeUtil. So now we can schedule Notification clean-up to run every month with following parameters:

monthRange

It will delete all notification between 2 month ago till 1 month ago.

Get started with Dynamics 365

Drive more efficiency, reduce costs, and create a hyperconnected business that links people, data, and processes across your organization—enabling every team to quickly adapt and innovate.