Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Tuesday, 9 June 2015

How to fetch item's unit based on Variant in ax 2012

Fetching item's unit based on item's variant in SO or PO

Write this code in modified field of salesline or purchase line

        select ecoResProductMaster where ecoResProductMaster.DisplayProductNumber == this.ItemId;
            // join ecoResProductMasterConfiguration where ecoResProductMasterConfiguration.ConfigProductMaster == ecoResProductMaster.RecId;
        select inventDimCombination where inventDimCombination.RetailVariantId == this.RetailVariantId
            join inventDim where inventDim.inventDimId == inventDimCombination.InventDimId
            join ecoResConfiguration where ecoResConfiguration.Name == inventDim.configId
            join ecoResProductMasterConfiguration where ecoResProductMasterConfiguration.Configuration == ecoResConfiguration.RecId
                && ecoResProductMasterConfiguration.ConfigProductMaster == ecoResProductMaster.RecId;
                this.salesunit = ecoResProductMasterConfiguration.PmfConfigUnitId;