Is there a way to check if a field was changed in ...
# suitescript
t
Is there a way to check if a field was changed in a User Event afterSubmit function with SS2.0? I seem to recall there being a property called isChanged or something like that
s
why not compare the values from the oldRecord and newRecord?
t
Good idea, I think that's probably what I'll end up doing. Thanks!
j
just make sure that if you compare date fields you compare using
newDateObj.getTime()  === oldDateObj.getTime()
If you do
newDateObj === oldDateObj
you will probably always get false
t
@jkabot good call, thanks for the heads up 🙂
k
Untitled
This is what I'm using for this purpose in a user event
then elsewhere in the script I can do
if(fieldChanged(context, 'fieldId', true)