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.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
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