How to create a product variant with Dimensions provided
ecoResDistinctProductVariant ecoResDistinctProductVariant;
EcoResProductVariantDimensionValue EcoResProductVariantDimensionValue;
RefRecId ecoResDistinctProductVariantRecId;
EcoResProductReleaseManagerBase releaseManager;
container productDimensions;
//Create a container to hold dimension values
productDimensions = EcoResProductVariantDimValue::getDimensionValuesContainer(ConfigurationName,
Size,
ColorId,
InventStyleId);
//Create Product search name
ecoResDistinctProductVariant.DisplayProductNumber = EcoResProductNumberBuilderVariant::buildFromProductNumberAndDimensions(
EcoResProduct::find(InventTable.Product).productNumber(),
productDimensions);
//Create Product variant with Product and dimensions provided
ecoResDistinctProductVariantRecId = EcoResProductVariantManager::createProductVariant(InventTable.Product,ecoResDistinctProductVariant.DisplayProductNumber,productDimensions);
//Find newly created Product Variant
ecoResDistinctProductVariant = ecoResDistinctProductVariant::find(ecoResDistinctProductVariantRecId);
//Now release the Product variant
releaseManager = EcoResProductReleaseManagerBase::newFromProduct(ecoResDistinctProductVariant);
releaseManager.release();
Hope this will help u guys :)
Dear Gaurav,
ReplyDeleteI need to enable product variants for production quality control in AX 2012. My thinking is to modify the quality association form to take care of product variants but I'm having an issue. Kindly advice on the best way to go about it
Thank you Gaurav, this was a big help.
ReplyDeleteHi.. I am facing below error for above job. Please help me.
ReplyDelete"The Style has not been assigned to the product."