I'm using Odata to update a variant in the Product Variants entity in D365. I have created proxy classes for this using the Odata Client Code Generator. I am first querying a specific product variant that returns a valid variant and then updating a 2 fields. I do not update the ProductVariantNumber field. When calling the SaveChanges method I get an error from D365:
"Update not allowed for field 'ProductVariantNumber'"
It seems the Odata call is trying to update the Product Variant Number even though I didn't change it and it appears D365 does not allow you to edit this value.
Here's my code:
var productVariant = context.ProductVariants
.AddQueryOption("$filter",
$"ProductMasterNumber eq '{productNumberEscaped}' and ProductConfigurationId eq '{configIdEscaped}'")
.FirstOrDefault();
if (productVariant != null)
{
productVariant.ProductDescription = dr["ProductDescription"].ToString();
productVariant.ProductName = dr["ProductName"].ToString();
context.UpdateObject(productVariant);
context.SaveChanges();
}
*This post is locked for comments
I have the same question (0)