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

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans