I'm attempting to do a very simple script to validate two fields prior to saving a customer/lead/prospect record. But when I put the code into the debugger, I end up receiving "unexpected error" invalid return. See below for code block.
{ var status = 14; var reason = nlapiGetFieldValue('custentity_reason_closed_field'); var dept = nlapiGetDepartment(); var primaryReason = nlapiGetFieldValue('custentity_primary_nr_reason'); var primaryReasonDetails = nlapiGetFieldValue('custentity_primary_nr_reason_det'); //status 14 is closed, and 29 is not renewed if ((status == '14' || status == '29') && (reason == null || reason == '')) { if (dept == 8 || dept == 10) { alert("Please enter a Reason Code for closing this record"); return false; //offending return statement } } return true; } So my "return false;" statement is what the debugger is throwing an error on. Not sure why, this appears to be correct to me, and per the NS help section of Saving Record Sample, this is practically a mirror. (example is in SuiteFlex>SuiteScript>SuiteScript Developer Resources>SuiteScript Samples>Client SuiteScript Samples>Save Record Example)I'm sure I'm overlooking something simple, but can someone lend a hand?Thanks!-Kurt