Luis
08/13/2023, 12:11 PMLuis
08/13/2023, 12:11 PM/**
* @NApiVersion 2.0
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(['N/currentRecord'], function (currentRecord) {
function fieldChanged(context) {
var currentRecord = context.currentRecord;
if (context.fieldId === 'cseg1') {
var headerFinancialLoc = currentRecord.getValue({
fieldId: 'cseg1'
});
log.debug('headerFinancialLoc: ', headerFinancialLoc);
var lineCount = currentRecord.getLineCount({
sublistId: 'item'
});
log.debug('Line Count: ',lineCount)
for (var i = 0; i < lineCount; i++) {
var lineFinancialLoc = currentRecord.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'cseg1',
line: i
});
log.debug('Line Financial Location: ', lineFinancialLoc)
if (!lineFinancialLoc) {
currentRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'cseg1',
line: i,
value: headerFinancialLoc
});
}
}
}
}
function lineInit(context) {
var currentRecord = context.currentRecord;
var headerFinancialLoc = currentRecord.getValue({
fieldId: 'cseg1'
});
currentRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'cseg1',
value: headerFinancialLoc
});
}
return {
fieldChanged: fieldChanged,
lineInit: lineInit
};
});
battk
08/13/2023, 1:44 PMbattk
08/13/2023, 1:45 PMbattk
08/13/2023, 1:45 PMLuis
08/13/2023, 11:41 PMreuben
08/13/2023, 11:47 PMbattk
08/14/2023, 12:02 AMbattk
08/14/2023, 12:05 AMLuis
08/15/2023, 4:08 AM