Does anyone here have experience using `currentRec...
# suitescript
m
Does anyone here have experience using
currentRecord.Sublist.isChanged
? I'm trying to move some SS1.0 code to SS2.0 and
context.currentRecord.getSublist({'sublistId':'item'}).isChanged
is returning
false
in
validateLine
where
nlapiIsLineItemChanged('item')
returns
true
in the 1.0 script. My temporary workaround is to use
window.nlapiIsLineItemChanged('item')
in the 2.0 script but I'd prefer to avoid that wherever possible.
The weirdest part is that
context.currentRecord.getSublist({'sublistId':'item'}).isChanged
is appropriately returning true in
validateField
, but that entry point gets me into recursive loop territory in this instance so I can't use that as an alternate workaround.
s
Well it would make a little bit of sense for the sublist to not be changed in validateLine, you are accepting/rejecting the change. But I tend to stay away from
sublist.isChanged
e
The
sublistChanged
entry point in 2.0 should fire any time the sublist is modified - as opposed to the 1.0
recalc
entry point which only fired when the total of a transaction changed
m
@erictgrubaugh Ah, good to know, thanks, I'll try that as an alternate approach.
I just tested that and it's not a perfect replacement for what I'm trying to convert over; I'm specifically trying to determine if any field was actually changed on the line, but
sublistChanged
fires anytime the
OK
button is pressed on a line regardless of whether or not any values were actually edited. It's a subtle difference but I'm using that to determine if additional processing is actually necessary or not, so it could affect performance to flag the sublist as changed unnecessarily.
I'm mostly just confused that
Sublist.isChanged
isn't returning the same thing as
window.nlapiIsLineItemChanged
given that the 1.0 to 2.0 function mapping shows the former as the equivalent of
nlapiIsLineItemChanged
, and 2.0 functions seem to often just be wrappers for 1.0 code.