以下脚本不会返回所需的警报。在 Netsuite 上使用调试器时,它仅突出显示用于定义函数的行。我在这里做错了什么?
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/currentRecord', 'N/ui/message', 'N/ui/dialog'], function(currentRecord, message, dialog) {
function validateLine(context) {
var rec = currentRecord.get();
if (context.sublistId === 'item') {
var lineItemChecked = rec.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'custcol21' // Your custom checkbox field
});
// If the checkbox is checked, show an alert
if (lineItemChecked === true) {
dialog.alert({
title: 'Bulk Delivery Alert',
message: 'Please apply Bulk Delivery for this item.'
});
}
}
return true;
}
return {
validateLine: validateLine
};
});
目的是当在报价或销售订单中的行中输入选中批量项目框的项目时,返回一个对话框以提醒用户这是批量交货项目。
检查以下内容: