customizeGlImpact(context)
The customizeGlImpact(context) function is used exclusively with SuiteScript 2.x, and is not compatible with SuiteScript 1.0
Function Declaration |
|
Type |
Interface function |
Description |
Contains the business logic to modify the general impact for a transaction with the Custom GL Lines Plug-in. Use the objects passed in the context to this function by NetSuite to implement the following business logic in a Custom GL Lines plug-in implementation:
Note:
You can also use SuiteScript API functions to access transaction record properties in a plug-in implementation. See Record. |
Returns |
void |
Input Parameters |
|
standardLines
Type |
StandardLines (read-only) |
customLines
Type |
CustomLines (read-only) |
transactionRecord
Type |
ReadOnlyTransactionRecord (read-only) |
book
Type |
AccountingBook (read-only) |
Example
/**
* @NApiVersion 2.x
* @NScriptType customglplugin
*/
define(function() {
function customizeGlImpact(context) {
var customLines = context.customLines;
var amount = '100.00';
var memo = context.transactionRecord.getValue({fieldId : 'memo'});
var firstAccount = context.standardLines.getLine({index: 0}).accountId;
var secondAccount = context.standardLines.getLine({index: 1}).accountId;
var bookId = context.book.id;
var firstLine = customLines.addNewLine();
firstLine.accountId = firstAccount;
firstLine.creditAmount = amount;
firstLine.memo = memo + ' for book ' + bookId;
firstLine.isBookSpecific = false;
var secondLine = customLines.addNewLine();
secondLine.accountId = secondAccount;
secondLine.debitAmount = amount;
secondLine.memo = memo + ' for book ' + bookId;
secondLine.isBookSpecific = false;
}
return {
customizeGlImpact: customizeGlImpact,
}
});