SuiteScript code to set line level values using debug console.

require(['N/record'], function(record) {
  var rec = record.load({
    type: '<recordtype>',
    id: 'recordId',
    isDynamic: true // Set this to true if the record is dynamic
  });

  // Set the value of a specific sublist field
  rec.selectLine({
    sublistId: '<sublistId>',
    line: <lineNumber>
  });
  
  rec.setCurrentSublistValue({
    sublistId: '<sublistId>',
    fieldId: '<SublistFieldId>',
    value: '<Value>'
  });

  rec.commitLine({ sublistId: '<sublistId>' });

  // Save the record
  var recordId = rec.save();
  console.log('Record saved with ID: ' + recordId);
});

Leave a comment

Your email address will not be published. Required fields are marked *