web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Add existing product category, product attribute and product attribute value to a product with x++

(0) ShareShare
ReportReport
Posted on by 1,080

Hi there!

I'm having some issues trying to "set" an existing Category Hierarchy, Category, Product Attribute and Product attribute value in X++ at the moment I create a new ecoResProduct record.

I have the product created and released to AX, I just need to set these values automatically. In addition, I also know how to get these values (http://axwonders.blogspot.com/2013/01/get-product-attribute-values-in-ax-2012.html) but I just can't set them at run time.

I have tried to insert independent pieces of records to the following tables:

EcoResValue (The recId of the existing attribute value, Instance Rel Type and Rel type)

EcoResValueAttribute (Value = the EcoResValue Rec Id and a fix attribute and the rec id of he InventTable rel type)

The above does not work and somehow the data is not reflected in the view EcoResProductAttribute value, which I think is th responsible for displaying the correct relationship of categories and product attributes.

Is anyone doing this? If so, would it be possible to get some sample code for it?

Thanks a lot!

 

*This post is locked for comments

I have the same question (0)
  • Florian Hopfner Profile Picture
    2,466 on at

    Hi,

    you could take a look at form EcoResAttributeValue and the logic in the methods there, especially createValue und attributeChanged to get an idea how to create these records.

    Other than that I assume your problem is with the attribute values and you are able to create the other records to associate a category from a category hierarchy to a product and associate product attributes. Please also note that not all category hierarchy roles support product attributes.

    Best regards

    FH

  • EduardoAndres Profile Picture
    1,080 on at

    Thanks for the reply. I have looked at those methods and basically what they do is "add" a new value to a category and/or product attribute, but theydo not create the relationship between product and attributes that I'm looking for.

    Thanks again.

  • Florian Hopfner Profile Picture
    2,466 on at

    Hi,

    please note that you can only add values to an attribute, not a category. To create a relationship between a product and an attribute, you would first have to create a relationship in table EcoResProductCategory between the product and a category and then a relationship between the category and the attribute in table EcoResCategoryAttribute.

    Take into consideration that method init of data source EcoResCategory in form EcoResAttributValue filters the available attributes to those of procurement (and retail, if you have installed Feature Pack) category hierarchies.

    Best regards

    FH

  • Eben Abraham Profile Picture
    10 on at

    Hi EduardoAndres ,

    Were you able to add attribute and its attribute values to a product through code? If yes can you please let me know how did you do it.

    Thanks

  • Suggested answer
    Kauto Profile Picture
    2,734 on at

    Hi All

    For anyone that is interested we had the same issue and I tracked it down to not having a relationship created in EcoResCategoryAttribute table for that Attribute RECID and the parent product Category - just one record here with modifier set to Category was enough to resolve as the data view EcoResProductAttribute had the relationship records successfully created

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans