Blog

How to create product master, variants and release it

Simple job that will create a product master, it's variant and then release it

   

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
static void CreateProduct(Args _args)
{
EcoResProductMasterManager manager = EcoResProductMasterManager::construct();
recId productMasterRecId;
EcoResDistinctProductVariant productVariant;
EcoResProductVariantCreationMgr productVariantCreationMgr = new EcoResProductVariantCreationMgr();
container productVariantContainer;
EcoResProductVariantDimValue productVariantDimValue;
EcoResTmpProductVariantSuggestion productVariantSuggestion;
EcoResProductDimGroupSetup productDimGroupSetup = EcoResProductDimGroupSetup::construct();
EcoResProductMasterConfiguration productMasterConfiguration;
EcoResConfiguration productConfiguration;
EcoResProductReleaseSessionManager releaseSessionManager = EcoResProductReleaseSessionManager::newReleaseSession();
 
try
{
ttsBegin;
//Creates product master
productMasterRecId = manager.createProductMaster("Product Name",
"Product Search Name",
EcoResProductType::Item,
EcoResVariantConfigurationTechnologyType::PredefinedVariants,
5637144576, //EcoResProductDimensionGroup::findByDimensionGroupName("CONFIG").RecId, //Product Group
5637144576, //EcoResStorageDimensionGroup::findByDimensionGroupName("STODIM01").RecId, //Product Tracking Dimension
5637144826); //EcoResTrackingDimensionGroup::findByDimensionGroupName("TRKDIM02").RecId); //Product Tracking Dimension
 
//Creates product master translations
EcoResProductTranslation::createOrUpdateTranslation(productMasterRecId, "Product Name", "Product Name Desc", "en-us");
 
 
 
 
productMasterConfiguration.ConfigProductMaster = productMasterRecId;
productMasterConfiguration.Configuration = 5637144593; //productConfiguration = EcoResConfiguration::findByName("STD");
productmasterconfiguration.Description = "Product Standard configuration";
productMasterConfiguration.AdditionalDescription = "Product Additional Description";
productMasterConfiguration.ConfigProductDimensionAttribute = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, ConfigId));
productMasterConfiguration.insert();
 
productVariantContainer = EcoResProductVariantDimValue::getDimensionValuesContainer("STD"); //precreated configuration dimension
 
EcoResProductVariantManager::createProductVariant(productMasterRecId, "Variant A", productVariantContainer);
 
releaseSessionManager.addProductMasterWithVariants(productMasterRecId);
releaseSessionManager.addLegalEntityForAllProducts(xDataArea::find(curext()).RecId);
releaseSessionManager.execute();
 
ttsCommit;
}
catch
{
ttsAbort;
}
 
}
view raw gistfile1.cs This Gist brought to you by GitHub.

Comments

Ahaa, its nice discussion about tgis piece of writing here at this web site, I have reead all that, soo at this time me also commenting here. https://www.huntingnet.com/forum/members/curtisreyes137.html Customized Composing Providers writing service writing service https://coub.com/danaobrien1999




Back to Blog

© 2020 Dynaxti, inc. All rights reserved.

Navigation

Social Media