AX 2012: Update Default Site

InventTable inventTable;
InventItemInventSetup inventItemInventSetup;
InventItemPurchSetup inventItemPurchSetup;
InventItemSalesSetup inventItemSalesSetup;
InventDim inventDim;

ttsBegin;
while select forUpdate inventTable
{
inventDim.initValue();
inventDim.InventSiteId = ‘T1’;
inventDim.inventLocationId = inventTable.inventLocationId();
inventDim = InventDim::findOrCreate(inventDim);

//Default order settings
inventItemInventSetup= inventItemInventSetup::findDefault(inventTable.ItemId, true);
inventItemInventSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemInventSetup.update();
inventItemPurchSetup= inventItemPurchSetup::findDefault(inventTable.ItemId, true);
inventItemPurchSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemPurchSetup.update();

inventItemSalesSetup= inventItemSalesSetup::findDefault(inventTable.ItemId, true);
inventItemSalesSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemSalesSetup.update();

}
ttsCommit;

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s