GL-Plugin is a standard Netsuite plugin that can be used to add custom GL lines in posting Transactions. However, it can’t be used to remove the standard GL lines in transactions.
The Gl-plugin can be enabled by navigating to Setup > Company > Enable Features > under SuiteCloud

/**
* Module Description
*
* Version Date Author Remarks 1.00 16 Sep 2019 Jobin and Jismi IT services LLP
* Revision date 30/10/2020 (update)
*
*/
function customizeGlImpact(transactionRecord, standardLines, customLines, book) {
try {
nlapiLogExecution('DEBUG', 'in inv', transactionRecord.getRecordType());
if (transactionRecord.getRecordType() == "assemblybuild") {
var recid = transactionRecord.getId();
nlapiLogExecution('DEBUG', 'recid', recid);
var recordid = transactionRecord.id;
nlapiLogExecution('DEBUG', 'recordid', recordid);
var assemblybuildSearch = nlapiSearchRecord("assemblybuild", null,
[
["datecreated", "onorafter", "7/1/2019 12:00 am"],
"AND",
["type", "anyof", "Build"],
"AND",
[["location.custrecord_isoutsidelocation", "is", "T"], "OR", ["location.internalid", "anyof", "6"]],
"AND",
["internalid", "anyof", recordid]
],
[
new nlobjSearchColumn("tranid"),
new nlobjSearchColumn("internalid"),
new nlobjSearchColumn("amount"),
new nlobjSearchColumn("creditamount"),
new nlobjSearchColumn("debitamount"),
new nlobjSearchColumn("account"),
new nlobjSearchColumn("location")
]
);
if (assemblybuildSearch) {
if (assemblybuildSearch.length) {
var totalCredit = 0, totalDebit = 0;
nlapiLogExecution('DEBUG', 'entered', assemblybuildSearch.length);
for (var i = 0; i < standardLines.getCount(); i++) {
if (standardLines.getLine(i).getCreditAmount() > 0) {
var newLine1 = customLines.addNewLine();
newLine1.setDebitAmount(standardLines.getLine(i).getCreditAmount());
newLine1.setAccountId(standardLines.getLine(i).getAccountId());
newLine1.setMemo(' ');
totalCredit += parseFloat(standardLines.getLine(i).getCreditAmount());
}
if (standardLines.getLine(i).getDebitAmount() > 0) {
var newLine1 = customLines.addNewLine();
newLine1.setCreditAmount(standardLines.getLine(i).getDebitAmount());
newLine1.setAccountId(standardLines.getLine(i).getAccountId());
newLine1.setMemo(' ');
totalDebit += parseFloat(standardLines.getLine(i).getDebitAmount());
}
}
var newCreditLine = customLines.addNewLine();
newCreditLine.setCreditAmount(totalCredit);
newCreditLine.setAccountId(250);
newCreditLine.setMemo(' ');
var newDebitLine = customLines.addNewLine();
newDebitLine.setDebitAmount(totalDebit);
newDebitLine.setAccountId(250);
newDebitLine.setMemo(' ');
}
}
} else if (transactionRecord.getRecordType() == "vendorbill") {
var recordid = transactionRecord.id;
var vendorbillSearch = nlapiSearchRecord("vendorbill", null,
[
["type", "anyof", "VendBill"],
"AND",
["datecreated", "onorafter", "7/1/2019 12:00 am"],
"AND",
["item.type", "anyof", "NonInvtPart"],
"AND",
[["location.custrecord_isoutsidelocation", "is", "T"], "OR", ["location.internalid", "anyof", "6"]],
"AND",
["internalid", "anyof", recordid]
],
[
new nlobjSearchColumn("internalid"),
new nlobjSearchColumn("location"),
new nlobjSearchColumn("tranid"),
new nlobjSearchColumn("account")
]
);
if (vendorbillSearch) {
if (vendorbillSearch.length) {
var totalValue = 0;
nlapiLogExecution('DEBUG', 'entered', vendorbillSearch.length);
for (var i = 0; i < standardLines.getCount(); i++) {
if (standardLines.getLine(i).getDebitAmount() > 0) {
var newLine1 = customLines.addNewLine();
newLine1.setCreditAmount(standardLines.getLine(i).getDebitAmount());
newLine1.setAccountId(standardLines.getLine(i).getAccountId());
newLine1.setMemo(' ');
totalValue += parseFloat(standardLines.getLine(i).getDebitAmount());
}
}
var newLine = customLines.addNewLine();
newLine.setDebitAmount(totalValue);
newLine.setAccountId(250);
newLine.setMemo(' ');
}
}
nlapiLogExecution('DEBUG', 'recordid', recordid);
} else if (transactionRecord.getRecordType() == "itemreceipt") {
var recordid = transactionRecord.id;
nlapiLogExecution('DEBUG', 'recordid', recordid);
var itemreceiptSearch = nlapiSearchRecord("itemreceipt", null,
[
["datecreated", "onorafter", "7/1/2019 12:00 am"],
"AND",
["type", "anyof", "ItemRcpt"],
"AND",
[["location.custrecord_isoutsidelocation", "is", "T"], "OR", ["location.internalid", "anyof", "6"]],
"AND",
["internalid", "anyof", recordid]
],
[
new nlobjSearchColumn("tranid"),
new nlobjSearchColumn("internalid"),
new nlobjSearchColumn("amount"),
new nlobjSearchColumn("creditamount"),
new nlobjSearchColumn("debitamount"),
new nlobjSearchColumn("account"),
new nlobjSearchColumn("location")
]
);
if (itemreceiptSearch) {
if (itemreceiptSearch.length) {
var totalValue = 0;
for (var i = 0; i < standardLines.getCount(); i++) {
if (standardLines.getLine(i).getDebitAmount() > 0) {
var newLine1 = customLines.addNewLine();
newLine1.setCreditAmount(standardLines.getLine(i).getDebitAmount());
newLine1.setAccountId(standardLines.getLine(i).getAccountId());
newLine1.setMemo(' ');
totalValue += parseFloat(standardLines.getLine(i).getDebitAmount());
nlapiLogExecution('DEBUG', 'line', standardLines.getLine(i).getDebitAmount());
}
}
var newLine = customLines.addNewLine();
var totalVal = totalValue.toFixed(2);
newLine.setDebitAmount(totalVal);
newLine.setAccountId(250);
newLine.setMemo(' ');
}
}
} else if (transactionRecord.getRecordType() == "itemfulfillment") {
var recordid = transactionRecord.id;
nlapiLogExecution('DEBUG', 'recordid', recordid);
var itemfulfillmentSearch = nlapiSearchRecord("itemfulfillment", null,
[
["type", "anyof", "ItemShip"],
"AND",
["datecreated", "onorafter", "7/1/2019 12:00 am"],
"AND",
[["location.custrecord_isoutsidelocation", "is", "T"], "OR", ["location.internalid", "anyof", "6"]],
"AND",
["internalid", "anyof", recordid]
],
[
new nlobjSearchColumn("internalid"),
new nlobjSearchColumn("location"),
new nlobjSearchColumn("tranid"),
new nlobjSearchColumn("account")
]
);
if (itemfulfillmentSearch) {
if (itemfulfillmentSearch.length) {
var totalValue = 0;
for (var i = 0; i < standardLines.getCount(); i++) {
if (standardLines.getLine(i).getCreditAmount() > 0) {
var newLine1 = customLines.addNewLine();
newLine1.setDebitAmount(standardLines.getLine(i).getCreditAmount());
newLine1.setAccountId(standardLines.getLine(i).getAccountId());
newLine1.setMemo(' ');
totalValue += parseFloat(standardLines.getLine(i).getCreditAmount());
}
}
var newLine = customLines.addNewLine();
var totalVal = totalValue.toFixed(2);
newLine.setCreditAmount(totalVal);
newLine.setAccountId(250);
newLine.setMemo(' ');
}
}
}
} catch (e) {
nlapiLogExecution('DEBUG', 'custom GL', e.message);
}
}