Product Attributes Creation

Hi All ,

Please tell me how to create product attributes(Shown in figure) for particular product using X++ code…

The attribute includes name and value…

Thanks in Advance…

You may have to insert data in \Data Dictionary\Tables\EcoResCategoryAttributeLookup
Look at \Data Dictionary\Tables\EcoResCatalogControl\Methods\synchronizeCategoryAttributeLookup for the implementation.

Hi Kranthi ,
Thanks for ur reply…
I have created Attribute via findorcreate method in Ecoresattribute table.The problem is i have to add that attribute to product category…
how to do this.?..

Hi Kranthi ,

Please tell me what i have to insert to that table…

You have to insert the data in \Data Dictionary\Tables\EcoResCategoryAttribute
and then \Data Dictionary\Tables\EcoResCategoryAttributeLookup (for this use same approach as \Data Dictionary\Tables\EcoResCatalogControl\Methods\synchronizeCategoryAttributeLookup)

Hi Kranthi ,
Thanks for ur reply.
The attribute is created .can you tell me how to give value for that attribute…

You may have to insert data in,
EcoResValue (it has sub types depending on the attribute data type)

Look into the below methods for reference,

Hi kranthi,
Thanks for ur reply…
I have a doubt in instance value for attribute…
How can i map Attribute to instance value…
As u said i have done the attribute creation…But the problem is In EcoresProductInstance table,the attribue is not getting updated…
Tell me if i have done anything wrong…
Thanks in advance…

Have you seen this? if you are unable to find the issue, please show us know your code.

public void createValue(EcoResValue newEcoResValue)
EcoResProductInstanceValue newEcoResProductInstanceValue;
EcoResAttributeValue newEcoResAttributeValue;


// Create new EcoResValue record

// Create EcoResProductInstanceValue record
newEcoResProductInstanceValue = EcoResProductInstanceValue::findByProduct(callerMasterOrDistinctProduct.RecId);
if (!newEcoResProductInstanceValue.RecId)
newEcoResProductInstanceValue.Product = callerMasterOrDistinctProduct.RecId;

// Create EcoResAttributeValue record
newEcoResAttributeValue = EcoResAttributeValue::findByInstanceAttribute(newEcoResProductInstanceValue.RecId, ecoResAttribute.RecId);
newEcoResAttributeValue.Value = newEcoResValue.RecId;
newEcoResAttributeValue.InstanceValue = newEcoResProductInstanceValue.RecId;
newEcoResAttributeValue.Attribute = ecoResAttribute.RecId;