GL Plugin impolementation
Hi,
In netsuite, I am currently creating a script for my GL Plugin implementation and I am getting this error {Syntax error: invalid return} when I try to save the script. The script is:
function customizeGlImpact(transactionRecord, standardLines, customLines, book)
{
try {
var transaction = context.transactionRecord;
var subsidiary = transaction.getValue({ fieldId: 'subsidiary' });
// Loop through standard GL lines
context.standardLines.iterator().each(function (line) {
// Example: Redirect revenue to custom account if subsidiary = 3
if (subsidiary == 3 && line.getCreditAmount() > 0) {
var customLine = context.customLines.addNewLine();
customLine.setAccountId({ accountId: 563 }); // custom revenue account
customLine.setCreditAmount({ creditAmount: line.getCreditAmount() });
customLine.setMemo({ memo: 'Redirected Revenue for Subsidiary 3' });
// Neutralize original line
line.setCreditAmount({ creditAmount: 0 });
}
return true;
});
} catch (e) {
log.error('Error in generateLines', e);
}
}
return {
generateLines: generateLines
};
});
Any ideas as to why this is happening?
Posted Jul 13, 2026, 4:23 PM UTC