What entry point should be be using in a Client sc...
# suitescript
s
What entry point should be be using in a Client script to check when a sublist column value is changed? i.e. trigger when qty of a BOM member is changed? Entry point descriptions and examples ive seen dont really help
b
đź‘€ 1
b
b
sublistChanged will get you when the add or okay button is pressed
👍 1
đź‘€ 1
s
I guess for the purpose to do a comparison between the previous value and the new value i would have to create two record objects before and after and compare them?
Is it possible to create a record object of when its not within the scope of the entry point?
Im guessing i use pageInit?
b
you wouldnt want an actual record, you can usually get by with much less
for example an array of previous values on each sublist line
s
define(['N/currentRecord','N/log','N/ui/dialog'], function (record, log, dialog) { //DO I GRAB THE PREVIOUS VALUES HERE? HOW DOES THAT LOOK SYNTAX WISE? function validateLine(context){ var currentRecord = context.currentRecord; //do stuff return true; } function validateDelete(context){ var currentRecord = context.currentRecord; //do stuff return true; } return { validateLine : validateLine, validateDelete : validateDelete } });
question is in caps
b
there are many ways to do it
your suggestion of pageInit is reasonable if you only wanted to get the previous values once
because the page is only init once
that usually means going through each line of the record and storing its value
s
ok i have an idea of what i need to do. Thanks @battk
r
Client scripts are notoriously complicated. When possible I would use a user event script. (Whenever the user doesn't need to see the result of their action.) If necessary, be sure to filter
runtime.executionContext
. Often times you'll only want
runtime.ContextType.USER_INTERFACE
to run your script.