I'm new in netsuite and I have to prove myself front of my boss. My problem is how can I get to a sublist and retrieve a field linked to another field in an automatic way when creating a new line.
function taxCode_fieldChanged(context) {
var stCodeTax = nlapiGetFieldValue('cust_taxcode');
var labelCategory = nlapiGetFieldValue('name');
var currentFormRec = context.currentRecord;
var sublistName = context.sublistId;
var sublistFieldName = context.fieldId;
var lineNum = scriptContext.lineNum;
var colNum = scriptContext.columnNum;
for (var l = 1; l < lineNum; l++) {
for (var c = 1; c < colNum; c++) {
if (sublistName === 'Expenses' && sublistFieldName === 'Category') {
currentFormRec.setValue({
fieldId : 'tax code',
value : stCodeTax
});
}
}
}
}