Announcements
No record found.
Hi Expert,
I am looking for X++ code to check items with no any transaction because somehow many items created unnecessary so I want to delete it.
*This post is locked for comments
I have actually done what you are attempting, i.e. deleted items "never" used.
The problem with simply notexists join on InventTrans is that items can be used in other ways than simply as inventory.
For example, some items are non-stock service items and never have InventTrans records, instead being used on Purchase order lines and Sales order lines.
Some items can be used on Sales quotation lines.
Or, used on Sales order lines, that were then confirmed (creating CustConfirmTrans records) and then deleted.
And then there are Bill of material lines.
The point is that if you want to delete InventTable records successfully, you'll have to consider all of the restricted relationships that AX itself will consider under validateDelete().
Also, the effort can cascade upstream. For example, on your first pass you might delete InventTable records and supporting bills of materials, and that might remove the final reference on additional InventTable records, and so on given however many levels your bills of materials might have.
It's actually more challenging than it seems on the surface.
Thanks Crispin & Brandon for suggestion.
Really it is not easly as its look.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CP04-islander 39
Michel ROY 14
imran ul haq 8