To reviewAX 2012

Check whether an inventory dimension is active for an item

Use InventDimGroupSetup and getFieldSetup to check whether a given inventory dimension, such as pallet ID, is active for an item.

Written for AX 2012; check InventDimGroupSetup and the pallet ID dimension on D365FO.

First written
Re-read
Versions
AX 2012

Before you read or set an inventory dimension in code, check that it is active in the item’s dimension groups. InventDimGroupSetup answers that for any InventDim field.

The original note

The code is shown as published.

InventTable inventTable;
InventDimGroupSetup inventDimGroupSetup;
InventDimGroupFieldSetup inventDimGroupFieldSetup;

inventDimGroupSetup = InventDimGroupSetup::newInventTable(inventTable);
inventDimGroupFieldSetup = inventDimGroupSetup.getFieldSetup(fieldNum(InventDim,WMSPalletId));

if (inventDimGroupFieldSetup.isActive())
{
    info(strFmt("The palletId dimension is active for dimension group   %1",inventDimGroupSetup.getStorageDimensionGroup()));));
}

References

  • No Microsoft Learn page was found for InventDimGroupSetup.