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.
This started happening yesterday; transactions from 2 days ago appear to be correct. I am not aware of any changes to the transaction happening in the last 2 days.
Does anyone have any suggestion on why/how this script could change behaviour and start creating the line at the end of the transaction instead of the start?