The Custom GL Lines Plug-in is a powerful tool used to modify the general ledger (GL) impact of standard and custom transactions in NetSuite. It is designed to help businesses comply with various global accounting standards by enabling the creation of custom transaction logic that can add or modify GL lines.
Key Features of the Custom GL Lines Plug-in:
- Add Custom GL Lines: This plug-in allows the addition of custom GL lines to transactions, beyond what is automatically generated by NetSuiteās standard accounting logic. These custom lines can represent charges, taxes, fees, or adjustments not captured by default.
- Apply Custom Segment Values: Custom GL lines can read and set custom segment values from both standard and custom transaction records, providing detailed control over how values are sourced and posted.
- Customization for Global Accounting Compliance: This plug-in is often used to meet specific accounting standards required by different countries or regions. For example, businesses may need to implement custom tax logic or financial reporting that requires additional GL line entries.
- Multi-Book Accounting and OneWorld Accounts: The plug-in supports advanced accounting features like Multi-Book Accounting, allowing different sets of financial statements for different subsidiaries or accounting books. For OneWorld accounts, the plug-in can be configured to apply custom GL logic at a subsidiary level.
Steps to Implement:
- Create a Plug-in Implementation: Develop a plug-in implementation using SuiteScript to define how the custom GL lines should be created and applied to different transaction types.
- Configure for Transactions: Assign the plug-in implementation to specific transaction types, accounting books, or subsidiaries as needed.
- Testing and Deployment: Once developed, thoroughly test the plug-in in your Sandbox account to ensure it modifies the GL impact as intended.
Example Scenario:
Consider an auction business where different types of fees need to be tracked and posted separately in the general ledger. Using the Custom GL Lines Plug-in, the developer can configure custom GL lines to post fees like the hammer price, buyer’s premium, third-party fees, and tax amounts to different GL accounts. This ensures accurate financial reporting and compliance with accounting standards.
By leveraging the Custom GL Lines Plug-in, businesses gain flexibility in how they handle financial transactions, allowing for detailed, accurate reporting and compliance across multiple locations or accounting books.
This article provides an overview of the Custom GL Lines Plug-in, showing how it is used to modify transaction impacts in NetSuite, with detailed control over custom and standard lines.
Sample script:
/**
* @appliedtorecord invoice
*/
function customizeGlImpact(transactionRecord, standardLines, customLines) {
nlapiLogExecution('DEBUG', 'Start of GL Plug-in', 'Script started!');
var itemDetailsArray = [];
var glAccounts = getCustomGLAccounts();
nlapiLogExecution('DEBUG', 'glAccounts', glAccounts);
nlapiLogExecution('DEBUG', 'glAccounts', glAccounts.hammer);
nlapiLogExecution('DEBUG', 'glAccounts', parseFloat(glAccounts.hammer));
for (var i = 1; i <= transactionRecord.getLineItemCount('item'); i++) {
var hammerAmount = parseFloat(transactionRecord.getLineItemValue('item', 'custcol_hammer', i)) || 0;
var buyersPremium = parseFloat(transactionRecord.getLineItemValue('item', 'custcol_buyers_premium', i)) || 0;
var thirdPartyFee = parseFloat(transactionRecord.getLineItemValue('item', 'custcol_jj_3rd_party_fee', i)) || 0;
var taxAmount = parseFloat(transactionRecord.getLineItemValue('item', 'custcol_jj_integration_tax', i)) || 0;
var totalcustomAmount = hammerAmount + buyersPremium + thirdPartyFee + taxAmount;
itemDetailsArray.push({
line: i,
hammerAmount: hammerAmount,
buyersPremium: buyersPremium,
thirdPartyFee: thirdPartyFee,
taxAmount: taxAmount,
totalcustomAmount: totalcustomAmount
});
}
var itemIndex = 0;
for (var j = 0; j < standardLines.getCount(); j++) {
var line = standardLines.getLine(j);
var accountId = line.getAccountId();
var creditAmount = line.getCreditAmount();
if (creditAmount && parseFloat(creditAmount) > 0) {
var itemDetails = itemDetailsArray[itemIndex];
var customDebitLine = customLines.addNewLine();
customDebitLine.setAccountId(accountId); // Debit the same account
customDebitLine.setDebitAmount(itemDetails.totalcustomAmount);
customDebitLine.setMemo('Total Custom Amount Debit');
if (itemDetails.hammerAmount && itemDetails.hammerAmount > 0) {
var hammerLine = customLines.addNewLine();
hammerLine.setAccountId(parseFloat(glAccounts.hammer));
hammerLine.setCreditAmount(itemDetails.hammerAmount);
hammerLine.setMemo('Hammer Amount');
}
if (itemDetails.buyersPremium && itemDetails.buyersPremium > 0) {
var buyersPremiumLine = customLines.addNewLine();
buyersPremiumLine.setAccountId(parseFloat(glAccounts.buyersPremium));
buyersPremiumLine.setCreditAmount(itemDetails.buyersPremium);
buyersPremiumLine.setMemo('Buyer's Premium');
}
if (itemDetails.thirdPartyFee && itemDetails.thirdPartyFee > 0) {
var thirdPartyFeeLine = customLines.addNewLine();
thirdPartyFeeLine.setAccountId(parseFloat(glAccounts.thirdPartyFee));
thirdPartyFeeLine.setCreditAmount(itemDetails.thirdPartyFee );
thirdPartyFeeLine.setMemo('Third Party Fee');
}
if (itemDetails.taxAmount&& itemDetails.taxAmount > 0) {
var taxLine = customLines.addNewLine();
taxLine.setAccountId(parseFloat(glAccounts.tax));
taxLine.setCreditAmount(itemDetails.taxAmount);
taxLine.setMemo('Tax Amount');
}
itemIndex++
}
}
}
/**
* Helper function to get custom GL accounts from a saved search.
*/
function getCustomGLAccounts() {
nlapiLogExecution('DEBUG', 'getCustomGLAccounts', 'getCustomGLAccounts');
var searchResults = nlapiSearchRecord("customrecordjj_gl_acc_custom_amounts", null, [
["internalid", "anyof", "1"]
], [
new nlobjSearchColumn("custrecordjj_acc_3rd_party"),
new nlobjSearchColumn("custrecordjj_acc_buyers_premium"),
new nlobjSearchColumn("custrecordjj_acc_hammer"),
new nlobjSearchColumn("custrecordjj_acc_tax")
]);
if (searchResults && searchResults.length > 0) {
var result = searchResults[0];
return {
thirdPartyFee: result.getValue('custrecordjj_acc_3rd_party'),
buyersPremium: result.getValue('custrecordjj_acc_buyers_premium'),
hammer: result.getValue('custrecordjj_acc_hammer'),
tax: result.getValue('custrecordjj_acc_tax')
};
}
// return {
// thirdPartyFee: 1390,
// buyersPremium: 273,
// hammer: 1330,
// tax: 1391
// };
}