//Info: HL-140
Changing Sublist fields does not always operate as expected in some circumstances.
One example is updating the tracking number in the Item Fulfillment record. Along with the regular rec.setCurrentSublistValue, we must include rec.selectLine and rec.commitLine routines as this field change dynamically.
var IFlineCount = itemFulfillment_rec.getLineCount({sublistId: 'package'});
if (IFlineCount == 1) {
itemFulfillment_rec.selectLine({
sublistId: 'package',
line: 0
});
var packagetrackingnumber = itemFulfillment_rec.getCurrentSublistValue({
sublistId: 'package',
fieldId: 'packagetrackingnumber'
});
itemFulfillment_rec.setCurrentSublistValue({
sublistId: 'package',
fieldId: 'packagetrackingnumber',
value: trackingnumber
});
itemFulfillment_rec.commitLine({
sublistId: 'package'
});
itemFulfillment_rec.save({
ignoreFieldChange: true
})
}