Tuesday, June 9, 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

if(this.RetailVariantId)
    {
        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;
                    //info(ecoResProductMasterConfiguration.PmfConfigUnitId);
                this.salesunit = ecoResProductMasterConfiguration.PmfConfigUnitId;
    }  

No comments:

Post a Comment