Sublist Line Item not Committing via SuiteScript 2.0 Client Script

Sometimes the user is not able to commit a line item via SuiteScript 2.0 Client Script. The reason why the line item is not committed on the script is because the forceSyncSourcing parameter retains its default value is false.We can resolve this by making forceSyncSourcing true.

The forceSyncSourcing parameter indicates whether to perform field sourcing synchronously. If set to true, sources dependent field information for empty fields synchronously.

Sample Script

function pageInit(scriptContext) {
  rec = scriptContext.currentRecord;
  rec.currentRecord.selectNewLine({
    sublistId : "item"
  })
  rec.currentRecord.setCurrentSublistValue({
    sublistId: "item",
    fieldId: "item",
    value : 25,
    forceSyncSourcing: true
  });
  rec.currentRecord.commitLine({
    sublistId: "item"
  });
}

Leave a comment

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