How to: Get Item default inventory dimensions
Views (79)
Good afternoon everyone,
Today I would like to share something very useful when creating a production order through code but somehow I wasn’t able to find about it on internet which is ‘How to get an Item default inventory dimensions’.
I have created an Job to show how it works:
static void _GetInventoryDimensions(Args _args)
{
InventTable inventTable = inventTable::find('D0004');
InventItemOrderSetupType setupType = InventItemOrderSetupType::Invent;
InventDim inventDim;
;
// Default Site
inventDim.InventSiteId = inventTable.inventItemOrderSetupMap(setupType).inventSiteId(inventDim.InventSiteId, inventTable);
// Default Location
inventDim.InventLocationId = inventTable.inventItemOrderSetupMap(setupType, <span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>InventDim::findOrCreate(inventDim).InventDimId) .inventLocationId(inventDim.InventLocationId, inventTable, inventDim.InventSiteId);<span id="mce_SELREST_end" style="overflow:hidden;line-height:0;"></span>
// Default ConfigId
inventDim.ConfigId = inventTable.StandardConfigId;
// Find Default Item Dimension
inventDim = InventDim::findOrCreate(inventDim);
info(strFmt('Invent Dim. Id: %1', inventDim.inventDimId));
info(strFmt('Site Id: %1', inventDim.InventSiteId));
info(strFmt('Warehouse Id: %1', inventDim.InventLocationId));
}
This was originally posted here.

Like
Report
*This post is locked for comments