如何在 2.0 Netsuite SuiteScript 中使用客户端脚本设置子列表值

Anu*_*mar 3 netsuite

在客户端脚本中使用时如何设置子列表值。我尝试了所有方法,但它不起作用并返回相同的错误。

fieldChanged: function(context){
     
     var record = currentRecord.get();
     
     //var record = context.currentRecord; // not working
    
         
     if(context.fieldId =='custpage_cancel'){
         
         var objSublist = record.getSublist({  //returns sublist obj but can not set 
         sublistId: 'custpage_sublist'
         });
        
    
        objSublist.setSublistValue({  // Not working ERROR: objSublist.setSublistValue is not a function
            fieldId : 'custpage_id',
            line : 0,
            value : true
        });
        
        // record.setSublistValue({        // Not working ERROR: objSublist.setSublistValue is not a function
         // sublistId: 'custpage_sublist',
         // fieldId: 'custpage_id',
         // line: 0,
         // value: true
        // });
         
     }
 }
Run Code Online (Sandbox Code Playgroud)

错误:截图

错误截图

Edw*_*mas 5

尝试选择行并设置值,在当前记录的网络套件中,他们更喜欢使用选择行并设置值

var records = context.currentRecord
 var lineNum = records .selectLine({
    sublistId: 'custpage_sublist',
    line: 0
});

    records.setCurrentSublistValue({
                        sublistId: 'custpage_sublist',
                        fieldId: 'custpage_id',
                        value: true,
                        ignoreFieldChange: true
                    });
   records.commitLine({
                        sublistId: 'sublistidentire'
                    });
Run Code Online (Sandbox Code Playgroud)