Quantcast
Viewing all articles
Browse latest Browse all 73760

Cannot create Product Master Variant using AIF (AX2012)

Hi.. good day everyone. I have a code for creating Product Variant here. i am trying to create a product variant with the folling combination:

Combination status
Size ok
Color
Configuration ok
Size-Color
Size-Configuration
Color-Configuration
Size-Color-Configuration

creation of Size and Configuration alone is done.. i can not create Product Variant with Color as dimension. here is my code:

 

 

var productVariant = new AxdEntity_Product_EcoResDistinctProductVariant

{

DisplayProductNumber = ProductVariant,

ProductType =

 

AxdEnum_EcoResProductType.Item,

SearchName = ProductVariant,

ProductMaster =

 

details.ProductNumber

};

productVariant.Translation =

 

new AxdEntity_Translation[1];

productVariant.Translation[0] =

 

new AxdEntity_Translation

{

LanguageId =

 

details.LanguageId,

Name =

 

details.TranslationName

};

_productVariant.VariantDimValue =

 

new AxdEntity_VariantDimValue_EcoResProductVariantDimensionValue[1];

_productVariant.VariantDimValue[0] =

 

new AxdEntity_VariantDimValue_EcoResProductVariantColor

{

DistinctProductVariant = ProductVariant,

ProductDimensionAttribute = 3169,

 

//color table

 

 

//TODO:

 

 

//Color = TxtColor.Text.Trim(),

Color =

 

"Green",

EcoResColor =

 

new AxdEntity_EcoResColor1[1]

{

 

 

new AxdEntity_EcoResColor1

{

 

 

//TODO:

 

 

//Name=TxtColor.Text.Trim()

Name =

 

"Green"

}

}

};

 

 

var axdProduct = new AxdEcoResProduct

{

Product =

 

new AxdEntity_Product_EcoResProduct[1] { _productVariant }

};

 

 

var callContext = new CallContext

{

Company =

 

details.Company

};

 

 

var productService = new EcoResProductServiceClient();

 

 

try

{

productService.create(callContext, axdProduct);

 

 

MessageBox.Show("Done");

}

 

 

catch (Exception e)

{

 

 

Console.WriteLine(e.Message);

 

 

Console.ReadKey();

}

 

i also cannot create Product Master Variant using the other combination. with this code:

private

 

 

static void CreateSizeColorVariant(AxdEntity_Product_EcoResDistinctProductVariant _productVariant)

{

_productVariant.VariantDimValue =

 

new AxdEntity_VariantDimValue_EcoResProductVariantDimensionValue[2];

_productVariant.VariantDimValue[0] =

 

new AxdEntity_VariantDimValue_EcoResProductVariantSize

{

DistinctProductVariant = ProductVariant,

ProductDimensionAttribute = 3173,

 

//size table

Size = TxtSize.Text.Trim(),

EcoResSize =

 

new AxdEntity_EcoResSize1[1]

{

 

 

new AxdEntity_EcoResSize1

{

Name=TxtSize.Text.Trim()

}

}

};

_productVariant.VariantDimValue[1] =

 

new AxdEntity_VariantDimValue_EcoResProductVariantColor

{

DistinctProductVariant = ProductVariant,

ProductDimensionAttribute = 3169,

 

//color table

Color = TxtColor.Text.Trim(),

EcoResColor =

 

new AxdEntity_EcoResColor1[1]

{

 

 

new AxdEntity_EcoResColor1

{

Name=TxtColor.Text.Trim()

}

}

};

 

 

var axdProduct = new AxdEcoResProduct

{

Product =

 

new AxdEntity_Product_EcoResProduct[1] { _productVariant }

};

 

 

var callContext = new CallContext

{

Company =

 

details.Company

};

 

 

var productService = new EcoResProductServiceClient();

 

 

try

{

productService.create(callContext, axdProduct);

 

 

MessageBox.Show("Done");

}

 

 

catch (Exception e)

{

 

 

Console.WriteLine(e.Message);

 

 

Console.ReadKey();

}

}

 

hope you can help me.. i've been trying to resolve this in days.. i've also tried regenerating CIL, refreshing the Services related , updating web service/reference and restarting everything. is there any easier work around for this?


Viewing all articles
Browse latest Browse all 73760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>