Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set sublist value using client script in 2.0 Netsuite SuiteScript

Tags:

netsuite

How to set sublist value when using in client script. I tried all the method but it's not working and returning the same error.

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
        // });
         
     }
 }

ERROR: Screenshot

Error ScreenShot

like image 757
Anurag Kumar Avatar asked Sep 18 '25 23:09

Anurag Kumar


1 Answers

Try selecting the line and set the value , In netsuite for current record they prefer to use select line and set values

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'
                    });
like image 98
Edwin Thomas Avatar answered Sep 23 '25 05:09

Edwin Thomas