https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
m

mg2017

04/06/2022, 4:09 PM
I have a Client Script and trying to add a line item on saveRecord. Tried: current_record.insertLine > current_record.setCurrentSublistValue > current_record.commitLine current_record.selectNewLine > current_record.setCurrentSublistValue > current_record.commitLine Also tried both without the commitLine. With CommitLine I can see the values getting set before the item line drops as its saving. What I'm I missing? Do I need to load the record first?
m

mattdahse

04/06/2022, 4:30 PM
The saveRecord entry point in client scripts is not a great place to add a new line. That entry point is really for validation.
That said, if I were doing it, I’d use currentRecord.selectNewLine() then use the currentLine APIs to set values and then call currentRecord.commitLine()
👍 1
b

battk

04/06/2022, 4:40 PM
CurrentRecord.setCurrentSublistValue is asynchronous, use forceSyncSourcing to avoid committing before the values are actually set
m

mg2017

04/06/2022, 6:15 PM
Thanks for the suggestion. The forceSyncSourcing resolved my issue.