Anyone know why a selectLine and/or commitLine wou...
# suitescript
c
Anyone know why a selectLine and/or commitLine would fail on a Client Script? I'm running this snippet and idx is always 0 unless I comment out the bit that sets the line value. N.B. I've been running this in the console and hence the simulation of the Client Script's scriptContext.
Copy code
require(['N/currentRecord'], function(currentRecord){
  var scriptContext = {currentRecord: currentRecord.get()};
  for (var i = 0; i < 3; i++) {
    scriptContext.currentRecord.selectLine({sublistId: 'item', line: i});
    console.log('idx', scriptContext.currentRecord.getCurrentSublistIndex({sublistId: 'item'}));

    scriptContext.currentRecord.setCurrentSublistValue({
      sublistId: 'item',
      fieldId: 'taxcode',
      value: 316
    });

    scriptContext.currentRecord.commitLine({sublistId: 'item'});
  }
});
a
hi Chris, I believe this is because selectLine and commitLine only work in Dynamic mode, but your code is getting the record in Standard mode
c
Thanks but there doesn't seem to be any issue with updating the first line but it just doesn't move on from there.