我尝试使用名为“备注类型”的自定义下拉字段强制在事务记录上使用标准备注字段 . 如果“备注类型”值为“其他”,则应强制使用标准备忘录 .
我在用户事件脚本中处理此代码以抛出“自定义错误消息”,以便在通过CSV导入导入数据时显示错误消息 .
抛出自定义错误消息,脚本工作正常,默认情况下,Netsuite将在下一页中抛出服务器端错误消息,要导航表单,应按下Go Back .
按下按钮时,页面字段数据将被清除,并尝试在“正文字段”级别和“子列表”级别添加“值” .
此时, I'm able to re-enter the values at the body fields Level and Unable to enter the Line Items on the Item Sublist
while seeing the console log it is showing the error message :"Uncaught RangeError: Maximum call stack size exceeded" only on the Google Chrome Browser.
Code:
Suite Script Version: 2.0
Type: User Event , Event: Before Submit
function beforeSubmit(scriptContext) {
log.debug("Value", " Before Submit Initiated");
var currentTranRecord = scriptContext.newRecord;
if (currentTranRecord != null && currentTranRecord != '' && currentTranRecord != undefined) {
var memoNotesValue = "1";
var isMemoEmpty = false;
var memoType = currentTranRecord.getValue('custbody_memo_type');
log.debug('Value', 'MemoNotes : ' + memoType);
if (memoType != null && memoType != '' && memoType != undefined) {
if (memoType == memoNotesValue) {
var memo = currentTranRecord.getValue('memo');
log.debug('Value', 'Memo : ' + memo);
if (memo == null || memo == '') {
if (scriptContext.type != scriptContext.UserEventType.DELETE) {
var errorObj = error.create({
code: 'CANNOT SAVE TRANSACTION RECORD',
message: 'Please enter the value for the Memo Field'
});
throw errorObj.code + '\n\n' + errorObj.message;
return false;
}
} else {
return true;
}
}
}
}
}
我已经研究过,当存在递归函数时,会发生“未捕获的RangeError:超出最大调用堆栈大小” . 但在我的情况下,我没有使用任何递归功能 . 但在Mozilla浏览器中,相同的代码工作正常 .
帮我理解上述错误的原因 . 提前致谢 .