Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

I am trying to create a price list item between a product and a pricelist existing ... throws an error when trying to save the object, why?! Thing missing or what I did wrong ?!

$
0
0

CODE:



var connection = crmConnection.Parse("Url=**** ; Username=***; Password=***");


int indexuom = this.uomlist.SelectedIndex;
int indexpricelevel = this.pricelevellist.SelectedIndex;
int indexproduct = this.productlist.SelectedIndex;
int indexqsc = this.DropDownListqsc.SelectedIndex;
int indexpmc = this.DropDownListpmc.SelectedIndex;


using (var context = new XrmServiceContext(connection))
{


Entity _Item = new Entity();
_Item.LogicalName = "productpricelevel";



_Item.Attributes.Add("pricelevelid", new EntityReference("pricelevelid", new Guid(pricelevelidlist[indexpricelevel])));
_Item.Attributes.Add("productid", new EntityReference("productid", new Guid(productidlist[indexproduct])));
_Item.Attributes.Add("uomid", new EntityReference("uomid", new Guid(uomidlist[indexuom])));

_Item.Attributes.Add("quantitysellingcode", new OptionSetValue(indexqsc));
_Item.Attributes.Add("pricingmethodcode", new OptionSetValue(indexpmc));

_Item.Attributes.Add("amount",new Money(30.0M))

context.AddObject(_Item);
context.SaveChanges();

}


Viewing all articles
Browse latest Browse all 79901

Trending Articles



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