I want to add a quotedetail with the help of javascript. Unfortuently i get the error: "The unit id is missing"
My code below:
var entity = {};
entity.Quantity = quantity;
entity.PricePerUnit = { Value: parseFloat(price).toFixed(2) };
entity.QuoteId = {
Id: quoteGuid,
LogicalName: "quote"
};
entity.ProductId = {
Id: "4d27a5a5-bf45-e311-b5c4-d48564519c0d",
LogicalName: "product"
};
entity.UoMId = {
Id: "101F9956-A121-4047-8844-9B02B438272B",
LogicalName: "uom"
};
entity.IsProductOverridden = true;
var url = window.location.protocol + "//" + window.location.hostname;
var req = new XMLHttpRequest();
req.open("POST", encodeURI(url + "/XRMServices/2011/OrganizationData.svc/QuoteDetailSet"), true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 201) {
var result = JSON.parse(req.responseText).d;
var newEntityId = result.QuoteDetailId;
alert("success");
getAllProductsOnQuote();
}
else {
alert(this.statusText);
}
}
};
req.send(JSON.stringify(entity));







