Monday, 28 September 2020
Use data entity and import through X++ code
EcoResProductV2Entity ecoResProductEntity;
NumberSequenceReference numberSequenceReference = EcoResProductParameters::numRefProductNumber();
NumberSequenceTable numberSequenceTable = numberSequenceReference.numberSequenceTable();
NumberSeq numberSeq = NumberSeq::newGetNumFromId(numberSequenceTable.RecId);
ecoResProductEntity.ProductNumber = numberSeq.num();
ecoResProductEntity.ProductSearchName = _prodIntegrationTable.SearchName;
switch (_prodIntegrationTable.ProductType)
{
case 'Item':
ecoResProductEntity.ProductType = EcoResProductType::Item;
break;
case 'Service':
ecoResProductEntity.ProductType = EcoResProductType::Service;
break;
}
switch (_prodIntegrationTable.ProductSubType)
{
case 'Product':
ecoResProductEntity.ProductSubType = EcoResProductSubtype::Product;
break;
case 'Product Master':
ecoResProductEntity.ProductSubType = EcoResProductSubtype::ProductMaster;
break;
}
ecoResProductEntity.RetailProductCategoryName = _prodIntegrationTable.Category;
if (ecoResProductEntity.ProductSubType == EcoResProductSubtype::ProductMaster)
{
ecoResProductEntity.ProductDimensionGroupName = _prodIntegrationTable.ProductDimensionGroup;
switch (_prodIntegrationTable.ConfigTechnology)
{
case "@SYS301180":
ecoResProductEntity.VariantConfigurationTechnology = EcoResVariantConfigurationTechnologyType::PredefinedVariants;
break;
case "@SYS301187":
ecoResProductEntity.VariantConfigurationTechnology = EcoResVariantConfigurationTechnologyType::DimensionBased;
break;
case "@SYS301188":
ecoResProductEntity.VariantConfigurationTechnology = EcoResVariantConfigurationTechnologyType::ConstraintBased;
break;
}
ecoResProductEntity.ProductVariantNameNomenclatureName = _prodIntegrationTable.ProdVariantNameNomenclature;
ecoResProductEntity.ProductVariantNumberNomenclatureName = _prodIntegrationTable.ProdVariantNumNomenclature;
}
EcoResProductV2EntityToCrossTableDataAdaptor adaptor = EcoResProductV2EntityToCrossTableDataAdaptor::newFromEntity(ecoResProductEntity);
EcoResProduct product = EcoResProductCrossTableManager::makeProductRecord(adaptor);
EcoResProductCrossTableManager::insert(adaptor, product);
BisProductCreationNPIImportProductCreation::updateEcoResProduct(_prodIntegrationTable, product.DisplayProductNumber);
return product;
Subscribe to:
Posts (Atom)