From a web resource I m updating OpportunityProduct records.
I can update string and number fields but can't update currency field.It is not showing any
error but just don't update it and value always remain 0.00.
Am I missing something or doing wrong ? Below is my code.
function UpdateRecord(guid, description, quantity, manualdiscountamount, priceperunit) {
var entity = {};
if (description != null && description !== "")
entity.ProductDescription = description;
entity.Quantity = parseFloat(quantity).toFixed(0);
if (priceperunit !== null && priceperunit !== 0)
entity.PricePerUnit = {
Value: "45.66"
};
if (priceperunit !== null && priceperunit !== 0)
entity.PricePerUnit_Base = {
Value: parseFloat(eval(priceperunit)).toFixed(2)
};
if (guid !== undefined) {
SDK.REST.updateRecord(guid, entity, "OpportunityProduct", function () {
alert("Completed");
}, function (error) {
Xrm.Utility.alertDialog(error.message);
alert("Error");
});
}I have tried setting currency value in different ways one above (by hard coding) and also as below:
Value: parseFloat(manualdiscountamount).toFixed(2) !== NaN ? parseFloat(manualdiscountamount).toFixed(2) : "0.0"
Or:
Value: parseFloat(eval(priceperunit))
Kindly guide if you can.






