To reviewAX 2012

Get the translated name of a product color from InventColorId

Two X++ steps to go from an InventColorId to the product master color record and its translated name.

Written for AX 2012; check the EcoRes methods used here on a current D365FO version.

First written
Re-read
Versions
AX 2012

InventDim.InventColorId holds the color code, but the name users see, possibly translated, lives on the product master. These two steps get from one to the other.

The original note

Step 1: retrieve the product master color

select ecoResProductMasterColor where ecoResProductMasterColor.Color == EcoResColor::findByName(inventDim.InventColorId).RecId
    && ecoResProductMasterColor.ColorProductMaster == inventTable.Product
    && ecoResProductMasterColor.ColorProductDimensionAttribute == EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, InventColorId))
;

Step 2: get the color translation

EcoResProductMasterDimValueTranslation::findByProductMasterDimValLanguage(ecoResProductMasterColor.RecId, 'it').Name

References

  • No Microsoft Learn page was found for these methods.