Get product attributes from X++

The product attributes is a nice feature, where we can add attributes to the products without adding any additional fields on to the inventory table.


But I wanted to be able to fetch out only the attribute names and values from X++, that had values.


Here is how I solved it.

static void Demo_GetProductAttributes(Args _args)
    inventTable                 InventTable;
    EcoResProductAttributeValue ecoResProductAttributeValue;
    EcoResAttribute             ecoResAttribute;
    EcoResValue                 ecoResValue;

    while select InventTable where InventTable.itemid == "1604"
        join RecId from ecoResProductAttributeValue
        where ecoResProductAttributeValue.Product == InventTable.Product
            join Name from ecoResAttribute
            where ecoResProductAttributeValue.Attribute == ecoResAttribute.RecId
                join ecoResValue
                where ecoResValue.RecId == ecoResProductAttributeValue.Value
        info(strFmt("%1 - %2 - %3", InventTable.ItemId, ecoResAttribute.Name, ecoResValue.value()));

I appreciate that I can be a part of this worldwide blog community—as a consultant working from Norway, the blog lets me share more than 20 years of experience with Microsoft Dynamics 365. Along the way, I participated in developing retail, PDA/RF, barcoding, master data, kitting and WMS-solutions for Dynamics. My blog focuses on my deepest interests and expertise: along with a 360 degree view of digital transformation topics, I welcome opportunities to dive into retail and intercompany supply chain automation, logistics, and production—everything that is moving around in a truly connected enterprise. As Enterprise Architect on Dynamics 365, I specialize in strategic development and planning for corporate vertical solutions and works to build international networks that increase knowledge and understanding for Dynamics 365. As an advocate for both providers and customers, I'm committed to ensure that customers constantly changing needs are meet, and I see community as key for increasing expertise. I welcome you to connect with me.

13 comments on “Get product attributes from X++

  1. Hi Kurt,

    I want to get Retail Attribute text value of SalesLine for a particular Attribute.

    And I am not sure how to get it. Please suggest how get it.


  2. I just had to quickly write this in SQL this gets me what I want

    d.TEXTVALUE AS textvalue,
    a.ITEMID AS itemid,
    FROM InventTable a,
    ecoResProductAttributeValue b,
    ecoResAttribute c,
    ecoResValue d
    AND c.ATTRIBUTETYPE = ‘5637151588’ –specify attribute

    Liked by 1 person

  3. Thanks, really helpful post .

    I have a question , what if i need to get this from all in SQL query not in X++ extension ?

    Can you please help me in that .


  4. Hello,
    I want create relation between inventTable and Product attribute value. The purpose is to use Product attribute in any AX report as filter/ criteria. Is it possible?


  5. Yesudeva Rao

    thanx its very useful..


  6. your post is very helpful. Thank you so much for sharing…..


  7. Hi
    Do you know why you can not use the Office Add-in tool to update the table InventTableModule, something you can do to have it fixed?
    What I would like to use it for is to have a better overview over our prices and update from Excel to AX with new prices. It is the last part for me that does not work, To push back new prices from Excel to AX


    • Hi Claes.
      The AX 2012 R1/FP had about 40% table coverage, as I’m sure that you have experienced. Microsoft has learned from this, and in the R2 release scheduled for 1/12/2012 they Increase this to 95% coverage. So this is the solution…. wait until R2 (if possible).

      The other thing I learned at the Tech Conferance this week, was some VERY NICE features in the Retail module, that you should look into. It’s called Mass Update Worksheet. I think this feature will solve many of Your issues of updating prices and other Properties on the InventtableModule. Take a look here : http://technet.microsoft.com/en-us/library/hh580603.aspx

      Keep fighting Claes, it’s Worth it 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: