<!here|@here> Continued apologies for spamming thi...
# suitescript
g
<!here|@here> Continued apologies for spamming this thread with my issues today, but I've been banging my head off this one for quite a while...can anyone give me any hints why the following Client script will not create a new line on my Suitelet LIST form?
Copy code
define(['N/runtime', 'N/search', 'N/record', 'N/currentRecord'],
  function(runtime, search, record, currentRecord) {
    function pageInit(context) {
      console.log('Found client script pageInit.');
    }
    function fieldChanged(context) {
      var current_record = currentRecord.get();
      var context_record = context.currentRecord;
      console.log('fieldChanged record: ' + context_record);
      console.log('fieldChanged field: ' + context.fieldId);
      console.log('fieldChanged sublist: ' + context.sublistId);
      console.log('fieldChanged line: ' + context.line);

      if (context.fieldId == 'vendorfilter') {
        //var vendor_text = ;
        var vendor_value = context_record.getValue('vendorfilter');
        console.log('Vendor has changed: [' +  vendor_value + ']');

        ////////////
        var num_lines = current_record.getLineCount({
          sublistId: 'item'
        });
        console.log('Found [' + num_lines + '] lines.');
        var newline = current_record.insertLine({
          sublistId: 'item',
          line: 0
        })
        console.log(newline);
        current_record.setCurrentSublistValue({
          sublistId: 'item',
          fieldId:   'purchasedescription',
          value:     'new description'
        });
        current_record.commitLine({
          sublistId: 'item'
        });
        return;