RE: Rounding Error on setValue (taxamountoverride)
Hey! I’m trying to set the value of taxamountoverride (invoice) and I get a ’rounding error’ for any value that is not zero.
Any idea how to overcome this issue?
Code:
It’s a user event script, aftersubmit.
rec.setValue({
fieldId: 'taxamountoverride', // Error on values that are not 0 / 0.00 etc.
value: salesTaxAmountFixedFormat
})
Error:
{
"type": "error.SuiteScriptError",
"name": "ROUNDING_ERROR",
"message": "Rounding Error: 1",
"stack":
[
"Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at insertTax (/SuiteScripts/tax_tst.js:245:13)\n at Object.afterSubmit (/SuiteScripts/tax_tst.js:21:9)",
],
"cause":
{
"type": "internal error",
"code": "ROUNDING_ERROR",
"details": "Rounding Error: 1",
"userEvent": null,
"stackTrace":
[
"Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at insertTax (/SuiteScripts/tax_tst.js:245:13)\n at Object.afterSubmit (/SuiteScripts/tax_tst.js:21:9)",
],
"notifyOff": false,
},
"id": "",
"notifyOff": false,
"userFacing": true,
}
Things I tried:
-
Change the format of the salesTaxAmount to a currency format (with ‘N/format/i18n’ module)
-
Passing 1 / 1.0 / 1.00 as the value
-
Using parseFloat(number).toPrecision() (passed 1 / 2 / 3)
Thanks in advance < 3
Hi,
Can you please message us or drop your email id? We are expert NetSuite Consultants in the USA. We will help you regarding all your NetSuite queries, and provide free expert consultation.
You may drop a message here: Contact NetSuite Consultants
or mail me manish.chaubey@streamssolutions.com
ElaineCCruz
you tried using only :
var value = 2
parseFloat(value )