web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to delete from / update "InventDim" table with X++

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

I want to delete a line in "InventDim" table, and also update fields 'inventBatchId' and 'InventSerialId' in another line it "InventDim" table with X++.

But it doesn't update or delete this table. Could anyone advise why? And how can I delete from / update "InventDim" table?

My code is as bellow:

ttsBegin;
select forUpdate inventDim
      where InventDim.inventDimId == _delDimId;
 if(inventDim)
       inventDim.delete();


while select forUpdate inventDim
     where InventDim.inventDimId == _lastDimId
      {
            inventDim.inventBatchId = _newBatch;
            inventDim.inventSerialId = _newSerial;
            inventDim.update();
       }
ttsCommit;

Thanks in advance

*This post is locked for comments

  • Verified answer
    André Arnaud de Calavon Profile Picture
    308,171 Super User 2026 Season 2 on at

    Hi Mernoosh,

    Due to the imporance of this table it is not recommended to delete or change records. To prevent wrong use Microsoft added an additional parameter on the delete and update methods of this table to indicate you really want to update or delete something.

    So you have to use:

    inventDim.update(true);

    and

    inventDim.delete(true);

    But be careful changing and deleting as you might cause data corruption as many records depends on the Inventory dimension combinations.

  • Verified answer
    Community Member Profile Picture
    on at

    InventDim table is backbone of Dynamics AX Inventory management module

    before deleting inventDim record using method inventDim.delete(true) you should do following validation

    * There should not be any record in InventSum table related the InventDimID which you are going to delete

    * There shuld not be any record in InventTrans table related to InventDimID whicu you are going to delete

    before updating inventDIM record using method inventDim.update(true) you should do following validation

    * ensure that inventTrans records related to inventDimID which is getting updated is good to get updated with new 'inventBatchId' and 'InventSerialId', otherwise you will have bad information is On-hand details

    * ensure that inventDim table is not having any record with new combination is inventory dimension, otherwise it will not get update.

    It is recommended that we should not do any outside update and  delete in InventDim Table, but if you will take care of above data intigrity checks then you can update and delete the records in InventDim Table with out any issue.

    Please verify and update us with your findings.

  • Community Member Profile Picture
    on at

    Thank you very much for your complete replies.

    It helped me a lot :)

    Kind Regards

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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Prashant Singh Profile Picture

Prashant Singh 2

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans