How does one set a value of `0` in the amount fiel...
# suitescript
e
How does one set a value of
0
in the amount field on a line? I'm trying in
validateLine
. Both setCurSubText and setCurSubVal return an error using
0
(must be greater than 0) and using
.00001
throws an error and enters a number in scientific notation.
Using a value of
'0.0001'
worked
m
'0'
might work as well - it's probably reading
0
as null (I'm guessing your error was for missing the required
value
)
e
'0'
doesn't work:
Invalid number (must be greater than 0).
m
Interesting, I'm sure I've set the
amount
field on plenty of lines to 0 in script before - what transaction type/item type are you working with?
e
it's a custom transaction, but I don't think that should matter
lines are inv. items
m
Odd. I just found this in some of our live code - it's definitely working without issue:
Copy code
currentPage.setCurrentSublistValue({
	'sublistId':'item',
	'fieldId':'rate',
	'value':0
});
Not sure if it'd work for your use case, but perhaps setting
rate
instead of
amount
and letting the sourcing do its thing for
amount
would get around that error?
e
thanks - it probably would if there was a rate field on my line. 🙂 Using
value: '0.0001'
works, so I'm good!
👍 1