Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Why SuiteScript Insert Line 0 - now adding at end?
I have a Client Script running under PageInit that adds a line to the start of a transaction:
function pageInit(context) {
var currentRecord = context.currentRecord;
var checkLine = currentRecord.getSublistValue({
sublistId: 'item',
fieldId: 'item',
line: 0
})
log.debug('sublistChanged','checkLine: ' +checkLine);
if (checkLine != 8957) {
currentRecord.insertLine({
sublistId: 'item',
line: 0
})
currentRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'item',
value: 8957,
fireSlavingSync: true
})
currentRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'rate',
value: -10,
fireSlavingSync: true
})
currentRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'custcol_sgl_reason_for_adjustment',
value: 20,
fireSlavingSync: true
})
currentRecord.commitLine({
sublistId: 'item'
})
}
}
This has worked successfully for a number of months, but recently the script has started adding the line at the end of the transaction.
Tagged:
0