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.
Please note that on Saturday, April 18, 2026, at 8:00 PM Pacific Time, our Case Management System will undergo a scheduled maintenance for approximately 15 minutes. During this time, case creation via SuiteAnswers will be unavailable and inbound calls will be routed to Customer Service.
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