Search code examples
axaptamicrosoft-dynamicsdynamics-ax-2012x++

Get the name of product from EcoResProduct or InventTable Dynamics ax


Does anyone know how to get the name of a product from EcoResProduct on Dynamics ax on a Job?

I found some things like I have to use the EcoResProductTraslation, but I cant find the relation or something to get the name.


Solution

  • The method InventTable.productName() might be useful for your purpose. The method finds a product variant that is based on the value of the _inventDimId parameter. If the product variant is found then its name is returned; otherwise, the name of a product that this item represents is returned. Please check the example below:

    InventTable           inventTable;
    EcoResProduct         ecoResProduct;
    EcoResProductName     productName;
    ;
    
    inventTable = InventTable::find('AnyItemId');          
    productName = inventTable.productName(SystemParameters::getSystemLanguageId());
    
    info(productName);
    
    ecoResProduct = EcoResProduct::find(inventTable.Product);         
    productName   = ecoResProduct.productName();
    
    info(productName);
    

    You can investigate the code of function to understand what it actually does. Also you can use cross references to find examples where it is used.