Paul Noris
Paul Noris

Reputation: 103

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.

Upvotes: 0

Views: 12392

Answers (2)

Aliaksandr Maksimau
Aliaksandr Maksimau

Reputation: 2281

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.

Upvotes: 2

FH-Inway
FH-Inway

Reputation: 5107

The data structure is indeed a bit tricky, but thankfully AX standard already has a display method that does the heavy lifting for you: EcoResProduct.displayProductName()

Upvotes: 1

Related Questions