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

时间:2017-11-16 22:57:44

标签: 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
    }


}

);

----这是错误

enter image description here

1 个答案:

答案 0 :(得分:5)

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

此外,N/currentRecord#CurrentRecord没有updateDisplayType()方法。

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

currentRecord.getField({
  fieldId: 'custrecord_hrx_vendor_status_list'
}).isDisplay = false;
相关问题