在字段更改时隐藏其他字段 - Suite Script 2.0

jeb*_*eee 1 netsuite suitescript

我想在选择框(选项)中选择项目后隐藏ID"custrecord_hrx_vendor_status_list".

这是我的代码./***@NApiVersion 2.x*@NScriptType ClientScript*/

define(['N/ui/serverWidget','N/error'],

function (error) {

    function fieldChanged(context) {
        var currentRecord = context.currentRecord;
        var fieldId = context.fieldId;
        if( fieldId === 'custrecord_hrx_negotiation_type' ){
            var selectedType = currentRecord.getText(fieldId);
            console.log(currentRecord.getField('custrecord_hrx_vendor_status_list'));

            currentRecord.updateDisplayType({
                id: 'custrecord_hrx_vendor_status_list',
                displayType: serverWidget.FieldDisplayType.HIDDEN
            });
        }
    }

    return {
        fieldChanged: fieldChanged
    }


}
Run Code Online (Sandbox Code Playgroud)

);

----这就是错误

在此输入图像描述

mic*_*oel 5

如错误消息所示,您正在尝试加载不可用的模块.您正在编写客户端脚本,并尝试加载仅用于服务器端脚本的模块.

另外,N/currentRecord#CurrentRecord没有updateDisplayType()方法.

在SS2.0客户端脚本中隐藏字段的方法是:

currentRecord.getField({
  fieldId: 'custrecord_hrx_vendor_status_list'
}).isDisplay = false;
Run Code Online (Sandbox Code Playgroud)