How to update inventdim table using findorcreate method in AX 2012

Hi All,

We Cannot Update InventDim Table using select forupdate statement like any other table as it will loose the combination of records maintained in inventory which is already used for transactions.

So, There is method which will find your record in InventDim Table, if it doesn’t find then it will create record with new combination.

Here is the code snippet used…………..

public void updateQuarantineWh(WMSJournalTrans _wmsjournalTrans)
InventLocationId inventLocationId;
InventLocationIdQuarantine inventLocationIdQuarantine;
InventDim inventdim;
inventLocationId = InventDim::find(_wmsjournalTrans.inventDimId).InventLocationId;
inventLocationIdQuarantine = InventLocation::find(inventLocationId).InventLocationIdQuarantine;
inventdim = InventDim::find(_wmsjournalTrans.inventDimId);
inventdim.InventLocationId = inventLocationIdQuarantine;
inventdim = InventDim::findOrCreate(inventdim);

_wmsjournalTrans.inventDimId = inventdim.inventDimId;


Happy Daxing……


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: