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

SDK.REST.updateRecord not updating Currency field ?

$
0
0

Hi Geeks,

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 value and the value always remains 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.


Viewing all articles
Browse latest Browse all 79901

Trending Articles



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