BeyondERP.Newsletter
Menu

Setup step on the Batch job clean-up page · System administration

Schedule the batch job table clean-up

Remove abandoned, one-time and recreated batch jobs so the batch job table doesn't slow other jobs.

Business process
Administer system features
Menu item
action:BatchJobCleanUp
Setup steps
1 on this page
Show what matters for
SETUP GUIDEHow to set it up8 sections. Choose a role to highlight what matters to you.
Everyone

1What it is and why

What it isA periodic job that deletes old batch job records, such as abandoned or one-time jobs, from the batch job table.
What you do hereUse this periodic task to stop the batch job table from growing and slowing down other jobs.
ExampleFor example, BEAT keeps 90 days of batch jobs: a nightly Batch job clean-up deletes Finished and Canceled jobs older than 90 days, 100 records per transaction, while Withhold stays cleared so held recurring jobs survive.
Batch job clean-up page in Dynamics 365
The page in Dynamics 365. page title tab to open what to set or check
Functional consultant · Solution architect

2Where it fits

End user · Functional consultant

3How to do it

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 itWhen abandoned, one-time or recreated batch jobs pile up in the batch job table and slow down other jobs.
How oftenRegularly, outside business hours, as Microsoft recommends.
Batch settingsSchedule it as a recurring batch job at night, one cleanup at a time.
What the output showsBatch job records older than the retention period with the selected statuses are deleted. Unlike the history cleanups, this removes the jobs themselves. A recurring job that disappeared usually means a status such as Withhold was included by mistake.

Source: Microsoft Learn

Setup steps on this page

Schedule the batch job table clean-up

Remove abandoned, one-time and recreated batch jobs so the batch job table doesn't slow other jobs.

Steps from Microsoft

  1. Go to System administration > Periodic tasks > Batch job clean-up.
  2. In Retain jobs (days), enter how many days of batch job records to keep.
  3. In Records to delete in a transaction, enter a value from 1 to 200; use a smaller value for jobs with large parameters or information logs.
  4. Narrow the jobs with Caption (an exact title, not case-sensitive), Class or Created by when only some jobs should go.
  5. Turn on Delete by end date time to judge age by the end of the last run instead of the creation date.
  6. Select at least one status to delete: Withhold, Error, Finished or Canceled.
  7. Run it outside business hours and never at the same time as another Batch job clean-up.

Source: Microsoft Learn

Fields on the page

FieldWhat it meansExample
Retain jobs (days)How many days of batch job records to keep.Microsoft Learn 90
Records to delete in a transactionHow many records are deleted per database transaction (1 to 200).Microsoft Learn 100
CaptionDeletes only jobs with exactly this title (not case-sensitive).Microsoft Learn
ClassDeletes only jobs with a task of this class.Microsoft Learn
Delete by end date timeUses the last run's end date instead of the creation date.Microsoft Learn
Created byDeletes only jobs created by this user.Microsoft Learn
Withhold, Error, Finished, CanceledThe terminal statuses to delete; select at least one.Microsoft Learn Finished and Canceled

Common errors and fixes

MessageWhat to do
A held recurring job disappeared after the clean-upWithhold was selected among the statuses to delete. Clear it, and recreate the job. Microsoft Learn
The clean-up ends with a database deadlockTwo Batch job clean-up runs overlapped. Run them one after another, outside business hours. Microsoft Learn

Test checklist

  1. Batch jobs older than the retention with the selected statuses are gone.
  2. Waiting and executing recurring jobs are still there.
  3. Jobs that don't match Caption, Class or Created by are untouched.

Source: Microsoft Learn

Functional consultant

4Setup decisions

Setup stepRecommended value and whyDecision, common mistake and test
Schedule the batch job table clean-upA recurring night run that deletes Finished and Canceled jobs older than the agreed retention, and Error jobs only after they are reviewedLearn: clean the batch job table regularly, outside business hours, one run at a time; at least one terminal status must be selected.Which statuses does the routine clean-up delete?Selecting Withhold to delete; a recurring job that an administrator held on purpose is deleted and must be recreated.Test: Only old jobs with the chosen statuses are removed

Feature management and licence

Licence or add-inAvailable from version 10.0.39 (Platform update 63). No Feature management feature needs to be turned on for this page.

Microsoft Learn

Solution architect

5Design impact

Shared or per companyShared: the batch job table has no company key, so the run removes matching jobs from every company unless Caption, Class or Created by narrows it. Microsoft data model
Can it be undoneNo: Deleted batch jobs can't be restored; you would have to create them again.
If you change it laterRun cleanups one at a time and outside business hours, because parallel runs can cause deadlocks. Microsoft Learn
Technical architect

6Technical

Menu itemaction:BatchJobCleanUp Checked in Dynamics 365
Developer

7Developer

Open it by URLhttps://<your-environment>/?mi=action:BatchJobCleanUp
Data migrationLoad order: Batch job clean-up has no data entity in Data management, so it can't be loaded from a file or a configuration template. It is a periodic job; schedule it again in each environment.Checked in Dynamics 365
Everyone

8Sources

To cite this step: SA-JOB-830, Schedule the batch job table clean-up. Beyond ERP Atlas Hub, 2026-11-11. https://www.beyonderp.cloud/atlas/step/SA-JOB-830