I’m looking for a way to prevent a SS1 `ValidateDe...
# suitescript
j
I’m looking for a way to prevent a SS1
ValidateDelete()
from executing when a sublist item is removed using a SS2
record.removeLine()
call. Background: We have a legacy SS1 script that’s quite complex and we don’t currently have the resources to rework it and rewrite it into SS2. One part of it is a
ValidateDelete()
function that is called when custom records are deleting from a sublist of custom records on a transaction (transaction is the parent record). The
ValidateDelete()
function is pretty simple: it updates a related text field to store a summary of some information in the sublist. Usually we want that to run every time a row in the sublist is deleted (we also have a
ValidateLine()
that performs similar logic). We are creating a “clear all <record> lines” function that will do as it says on the tin, it does a
record.removeLine()
one by one (starting at the end of the list and working backwards) to remove the lines in the sublist. The calls to
removeLine()
have
ignoreRecalc
set to
true
. Despite this, the
ValidateDelete()
is still being called. How can I prevent this?
b
You don't. Add a gaurd clause to the ValidateDelete to return true early
j
Thanks for confirming @battk, this is the approach I implemented, was hoping there was something more native NetSuite I was missing. Alas, no.