在 NetSuite 中向自定义事务表单添加操作

Add Action to Custom Transaction Form in NetSuite

我正在尝试向 NetSuite 中自定义事务表单的 "Actions" 菜单添加新菜单选项。我可以在表单的“操作”菜单中看到我的选择,但无法在我的 UserEvent 脚本中触发 beforeLoad 函数以在选择“操作”时调用 clientScript。

当我按原样 运行 代码时,我收到一条消息说 "beforeLoad" 未定义,尽管我在脚本底部返回函数。我无法向 'Standard Actions Tab' 添加操作,尽管那似乎是存在其他操作的地方。

非常感谢任何帮助! :)

 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 */

define([], 
    function () {
        function beforeLoad(context) {
            if(context.type == 'edit'){
                context.form.clientScriptModulePath = 'folder/clientscriptpath.js';
            }
        }

        return {
            beforeLoad: beforeLoad
        };
    }
);

我相信你必须加载 'N/ui/serverWidget' 模块才能使用 context.form