Get the color name on the bases of item varient along with Lang


/// <summary>

/// Finds color name for particular product and language.

/// </summary>

/// <param name="_product">

/// Product Id.

/// </param>

/// <param name="_languageId">

/// Language Id.

/// </param>

/// <returns>

/// Color name in specified language.

/// </returns>

public static Name getColorName_POR(EcoResProductRecId _product, LanguageId _languageId, inventdim _inventDim = null, EcoResColorName _colorID = null)

{

    EcoResProductMasterColor ecoResProductMasterColor;

    EcoResColor              ecoResColor;

    Name                     colorName;


    if(_inventDim)

    {

        ecoResColor =  EcoResColor::findByName(_inventDim.InventColorId);

    }

    else if(_colorID)

    {

       

        ecoResColor =  EcoResColor::findByName(_colorID);

    }

    else

    {

        return '';

    }


    ecoResProductMasterColor = EcoResProductMasterColor::find(_product, ecoResColor.RecId);


    colorName = EcoResProductMasterDimValueTranslation::getNameOrDefaultName(ecoResProductMasterColor.RecId, _languageId);


    return colorName;

}


======================================================================



purchPurchaseOrderTmp.Color_POR       =   ReportHelper_POR::getColorName_POR(EcoResProductMaster::find(inventTable::find(purchPurchaseOrderTmp.ItemId).Product).RecId, SystemParameters::getSystemLanguageId(), inventDim, null);


=====================================================================



salesConfirmTmp.ColorName_POR      =  ReportHelper_POR::getColorName_POR(EcoResProductMaster::find(inventTable::find(salesConfirmTmp.ItemId).Product).RecId, SystemParameters::getSystemLanguageId(),null, salesConfirmTmp.Color_POR);


======================================================================




Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++