I just started my journey with Suitescript 2.0 development. I have created a client script and attached it to an Opportunity. In the client script I have added a few simple console log statements like:
function validateLine(context) {
console.log('validateLine', context);
alert("Line is changed!");
return true;
}
/*
* Execute code when field is changed
*/
function fieldChanged(context) {
console.log('fieldChanged', context);
}
function validateInsert(context) {
console.log('validateInsert', context);
}
The validateLine + fieldChanged is working. However I can't seem to trigger the validateInsert function. I have tried everything, added a field, made a copy, saved the record but the validateInsert does not seem to be triggered because I am not getting any console logs.
How can I trigger the validateInsert?
My intention is to use the validateInsert trigger for the "Make Copy" button. The "Make Copy" button copies a line item. Validations are being made when copying a lineitem + the copied line item needs to get filled with specific data. If there is any advice or other tips, please let me know.