Hi ,
I am working on Ax 2012 R2.
When I configure an Item in sales Line it is generating the new config Id as below.
Now I have a requirement to generate that Config Id by X++.
can anybody suggest how can I achieve this. I have Item Id and other parameters but dont have an Idea from where to start the coding to generate that configuartion Id.
Please suggest.
What does that mean? Please elaborate
I mean I need to generate the config Id through the Job(X++) ,to generate that I have Item Id (I know ItemId )and other attributes(Variants).
But dont have an Idea how to do it by code.
Please suggest
Why do you have to do it with code when the configure line option in AX already does that?
I have a requirement that I need create BOM and BOM lines By X++, through Excel Data which is providing by client while creating the BOM lines I need to generate new config id and I need to assign it to the BOM line
Kindly suggest
Do you mean creating a product variant? If so, what is the configuration technology on the product?
Yes Kranthi. I need to create product variant.
It is predefined configuration technology…
You can use this method to create a variant, \Classes\EcoResProductVariantManager\createProductVariant
For reference see, \Classes\RetailKitConfigurator\insertNewVariant
Hi Kranthi,
I have checked the above but could not understand.
Can you please help how exactly to generate new configuration Id and assign it BOM line?
Which part of it you didn’t understood?
Have you looked at this method?
Insert data into,
EcoResConfiguration
EcoResProductMasterConfiguration
EcoResProductMasterDimValueTranslation
and call EcoResProductVariantManager::createProductVariant
I am not able to see that class itself under AOT
Try this code,
EcoResProduct productMaster = EcoResProduct::findByProductNumber('L0026');
EcoResProductMasterConfiguration ecoResProductMasterConfiguration;
EcoResProductMasterDimValueTranslation productMasterDimValueTranslation;
EcoResConfiguration ecoResConfiguration;
RefRecId configDimensionAttributeRecId = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, ConfigId));
EcoResConfigurationName configurationName = 'Test';
RefRecId distinctProductVariantRecId;
ecoResConfiguration = EcoResConfiguration::findByName(configurationName);
if (!ecoResConfiguration)
{
ecoResConfiguration.Name = configurationName;
ecoResConfiguration.insert();
}
ecoResProductMasterConfiguration.ConfigProductMaster = productMaster.RecId;
ecoResProductMasterConfiguration.ConfigProductDimensionAttribute = configDimensionAttributeRecId;
ecoResProductMasterConfiguration.Configuration = ecoResConfiguration.RecId;
ecoResProductMasterConfiguration.insert();
productMasterDimValueTranslation.ProductMasterDimensionValue = ecoResProductMasterConfiguration.RecId;
productMasterDimValueTranslation.Name = 'Test';
productMasterDimValueTranslation.Description = 'Test';
productMasterDimValueTranslation.LanguageId = 'en-us';
productMasterDimValueTranslation.insert();
distinctProductVariantRecId = EcoResProductVariantManager::createProductVariant(productMaster.RecId, configurationName,
[[configDimensionAttributeRecId, ecoResConfiguration.RecId]]);
EcoResProductReleaseManagerBase::releaseProduct(distinctProductVariantRecId, CompanyInfo::findDataArea(curext()).RecId);
}
Hi Kranthi
The Table EcoResProductMasterDimValueTranslation is not availabe
Hi Kranthi,
The table “EcoResProductMasterDimValueTranslation” is not available
It is used to store name and description in R3.
You can use, EcoResProductTranslation