无法运行使用定义函数的 Netsuite 脚本

问题描述 投票:0回答:1

以下脚本不会返回所需的警报。在 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
    };
});

目的是当在报价或销售订单中的行中输入选中批量项目框的项目时,返回一个对话框以提醒用户这是批量交货项目。

netsuite suitescript2.0
1个回答
0
投票

检查以下内容:

  • netsuite 中的文件名末尾是否有 .js 附加?
  • 部署处于测试状态还是发布状态?
  • 脚本记录和部署记录不是处于非活动状态吗?
  • 是否包含上下文 UI?
© www.soinside.com 2019 - 2024. All rights reserved.