New to UserEvent scripts and have mostly only used...
# suitescript
b
New to UserEvent scripts and have mostly only used afterSubmit. I currently have a csv import that is adding to a custom record. I then have an afterSubmit script that runs after the custom record is saved to update the original transaction record (journal entry or expense report or vendor bill). My user has asked to add some validation to the script, i.e. if the amount in the csv file to be imported is more than the amount on the transaction record, don't allow the import. Is this possible? If so, I'm guessing this should be done as a beforeSubmit function. If that's correct, can I load the existing transaction record in the beforeSubmit function and then also use that object in the afterSubmit? Or do I have to load it again? I don't fully understand how these two functions work together in NetSuite.
m
You can throw an error during the beforeSubmit event to prevent the import.