Version 10.0.49: the menu item, form, table and security, the page.
Recommended values
Based on Microsoft's documentation. A sound starting point to adjust to your own business requirements.
Tests
A ready-to-run test, “Closed entries removed, open on-hand unchanged”, to confirm this setup in your own test environment.
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 is
A periodic job that deletes closed and unused on-hand entries for items that use one or more tracking dimensions.
What you do here
Use this periodic task to make on-hand inventory queries run faster.
Example
For example, BEAT tracks headsets by serial number and has 3.1 million closed on-hand rows with zero quantity and cost. BEAT runs On-hand entries cleanup weekly with Delete if not updated for this many days set to 30, after finance agrees that past-date Physical inventory by inventory dimension reports may show gaps.
The page in Dynamics 365. page title tab to open what to set or check
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
When on-hand queries for items with tracking dimensions slow down because of many closed, zero on-hand entries.
How often
On demand or as a recurring batch job. Microsoft gives no fixed interval.
Batch settings
Run it as a recurring batch job so closed entries are removed regularly, and test it first in a test environment.
What the output shows
Fewer on-hand rows for items with tracking dimensions: closed entries whose quantities and cost values are all zero are deleted. On-hand for items without tracking dimensions is never touched. Gaps in past-date reports point to entries this job removed.
Run On-hand entries cleanup safely and only when the data is no longer needed.
Steps from Microsoft
Go to Inventory management > Periodic tasks > Clean up > On-hand entries cleanup.
In Delete if not updated for this many days, enter how long a closed on-hand entry must stay unchanged before it's deleted (the default is 7). Entries that change during that period are kept.
Before you run it, agree with the people who use the Physical inventory by inventory dimension report, because the job can remove data that report needs for past dates.
Use Records to include to limit which on-hand entries are considered, and set batch options under Run in the background.
Afterwards, open on-hand for an item with batch or serial tracking: open quantities and values are the same, and only closed entries with zero quantity and cost are gone.
Closed entries that haven't changed for this many days are deleted; the default is 7.Microsoft Learn
30
Common errors and fixes
Message
What to do
The Physical inventory by inventory dimension report for a past date misses lines.
The job removed closed entries that report used. Agree with the report users before you run it, and keep a longer day limit if they need history. Microsoft Learn
Test checklist
Note the open on-hand of three serial-tracked items.
Run the job in a copy with 30 days.
Check that their open on-hand is unchanged.
Check that closed zero entries older than 30 days are gone and newer ones remain.
Run it as a recurring batch job with a day limit agreed with the report users, for example 30 days instead of the default 7.Only closed entries with zero quantities and costs for items with tracking dimensions are removed, which speeds up on-hand queries, but past-date reports lose that detail.
On the live system, Information technology manager use this page.
Checked in Dynamics 365
Solution architect
5Design impact
Shared or per company
Per company: the job reads and changes only the data of the legal entity you run it in. Checked in Dynamics 365
Can it be undone
Irreversible: Closed on-hand entries with zero quantity and cost are deleted for good, and reports for past dates can show incomplete data. Run it first in a copy of production, such as a sandbox refreshed from production, and give the privilege only to the people who own the cleanup.
If you change it later
Historical and "as of date" reports can show incomplete data for periods where on-hand rows were removed. Microsoft Learn
Technical architect
6Technical
Menu item
action:InventCleanupTrackingInventSumChecked in Dynamics 365
Form
SysOperationTemplateFormChecked in Dynamics 365
Who can open it
1 security role. Select a role to see its duties and privileges.
DutyMaintain system settingsSysServerSettingsMaintain
PrivilegeClean up closed on-hand entriesInventCleanupTrackingInventSumProcess
Roles worked out from Microsoft's standard security setup and checked in a working Dynamics 365 system (version 10.0.49)
Roles to set it up and use it
To use itInformation technology manager SysServerITManagerGive people one of these roles. On this system, 1 role can run this page.Checked in Dynamics 365
Load order: On-hand entries cleanup has no data entity in Data management. On-hand entries come from the opening on-hand journals and later transactions; nothing is migrated for this job.Checked in Dynamics 365