Hello,
I try to create Released product and its attributes with the below code, using data entities. (Runnable class).
Product is created and released sucesfully.
When the line "ecoResProductAttributeValueEntity.insert();" is executed I'm getting the error message "Matching record with key 'Product': 68719519121 for the data source 'EcoResProductCategory' does not exist".
After it I tried to create value in EcoResProductCategory too. It is also created sucesfully, but at the end I still get the same error from EcoResProductAttributeValueEntity.insert();
I'm trying to do it now in job, but later I have to develop the csv file import, which should create Released products, create / assign Attributes to it, etc...
What am I doing wrong?
EcoResReleasedProductCreationV2Entity ecoResReleasedProductCreationV2Entity;
ecoResReleasedProductCreationV2Entity.clear();
ecoResReleasedProductCreationV2Entity.initValue();
ecoResReleasedProductCreationV2Entity.ItemNumber = 'AAA_Item';
ecoResReleasedProductCreationV2Entity.ItemModelGroupId = 'GDD';
ecoResReleasedProductCreationV2Entity.InventoryUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.ProductGroupId = 'FG';
ecoResReleasedProductCreationV2Entity.ProductType = EcoResProductType::Item;
ecoResReleasedProductCreationV2Entity.ProductNumber = 'AAA_Item';
ecoResReleasedProductCreationV2Entity.ProductSearchName = 'AAA_Item';
ecoResReleasedProductCreationV2Entity.ProductName = 'AAA_Item';
ecoResReleasedProductCreationV2Entity.TrackingDimensionGroupName = 'None';
ecoResReleasedProductCreationV2Entity.ProductSubType = EcoResProductSubtype::Product;
ecoResReleasedProductCreationV2Entity.SearchName = 'AAA_Item';
ecoResReleasedProductCreationV2Entity.SalesUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.StorageDimensionGroupName = 'SiteWH';
ecoResReleasedProductCreationV2Entity.PurchaseUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.insert();
EcoResProductCategory ecoResProductCategory;
ecoResProductCategory.clear();
ecoResProductCategory.initValue();
ecoResProductCategory.Product = EcoResProduct::findByProductNumber(ecoResReleasedProductCreationV2Entity.ProductNumber).RecId;
ecoResProductCategory.Category = 68719484036;
ecoResProductCategory.CategoryHierarchy = 68719479747;
ecoResProductCategory.insert();
EcoResProductAttributeValueEntity ecoResProductAttributeValueEntity;
ecoResProductAttributeValueEntity.clear();
ecoResProductAttributeValueEntity.initValue();
ecoResProductAttributeValueEntity.ProductNumber = ecoResReleasedProductCreationV2Entity.ProductNumber;
ecoResProductAttributeValueEntity.AttributeName = "xxx";
ecoResProductAttributeValueEntity.BooleanValue = NoYes::Yes;
ecoResProductAttributeValueEntity.insert();