NetSuite has a “Custom GL Lines Plug-in” feature which you can use for GL Lines customization. Most of the NetSuite users enter the journal entries manually. If you want to automate your journal entries – the Custom GL Lines Plug-in feature comes in handy.
The Custom GL Lines Plug-in modifies the overall ledger impact of standard and custom transactions. You can use the Custom GL Lines Plug-in to suit a good range of worldwide accounting standards by applying custom transaction logic that adds lines to the NetSuite GL Impact page.
NetSuite OneWorld accounts can set this plug-in to run for specific subsidiaries. Accounts with the Multi-Book Accounting feature enabled can set the plug-in implementation to run for specific accounting books.
In this blog we are going to explain how this plugin is implemented and the process of customizing GL impact.
As an example, we have taken custom commission calculations on Invoices as the use case. If commission is custom-calculated there will be no accounting impact for the calculated amount. In this post, we will show how to use the Custom GL Lines Plugin to modify the GL Impact of the Invoice to add lines in the GL Impact for a commission amount on saving the approved invoice record.
Steps to Customize GL Impact
- Go to Setup →Company →Enable Features →Click SuiteCloud Subtab→Custom GL Lines Plug-in
- Enable the above feature. Now we need to create a Plug-in Implementation. To create a plug-in implementation: Go to Customization →Plug-ins →Plug-in Implementations →New
- In the plug-in implementation, we need to add implementation script and library files which we are going to use for customizing GL. Below screen will appear if you click on the New link which is shown in the above screenshot. In the below screenshot you have to select the script file (.js file) which you have created and uploaded into the NetSuite File Cabinet.
- Example code snippet for GL Lines Customization
function customizeGlImpact(transactionRecord, standardLines, customLines, book) { var countStandard=standardLines.getCount(); nlapiLogExecution("DEBUG", "Line Count",standardLines.getCount()); //To get the first standard line which appear in the GL impact var currLine = standardLines.getLine(0); //To get the entity from the standard line var entityId = currLine.getEntityId(); //To get the subsidiary which is chosen on the transaction var tranSubsidiary=transactionRecord.getFieldValue('subsidiary'); //To get the record type of the transaction var recordType=transactionRecord.getRecordType(); nlapiLogExecution("DEBUG", "Subsidiary",tranSubsidiary); //To get the custom field value which is on the transaction var commission= parseFloat(transactionRecord.getFieldValue('custbody_commission_total')); if(recordType == 'invoice'){ if(commission>0){ nlapiLogExecution("DEBUG", "commission",commission); //To add new custom line in the GL impact var newLine = customLines.addNewLine(); //To set debit amount newLine.setDebitAmount(commission); //set debit account- commissions account - 140 is the internal id of the respective account newLine.setAccountId(140); newLine.setEntityId(entityId); newLine.setMemo("Commissions"); //To add new custom line in the GL impact var newLine = customLines.addNewLine(); //To set Credit amount newLine.setCreditAmount(commission); //set credit account- commission liability account - 120 is the internal id of the respective account newLine.setAccountId(120); newLine.setEntityId(entityId); newLine.setMemo("Commissions Liability"); } } }
- After selecting the script file, click on Create New Plug-in implementation. Select Plug-in Type page will appear on the screen and select the Custom GL lines Plug-in from the options.
- After selecting/clicking on the Custom Gl Lines Plug-in Type, the plug-in implementation page will appear on the screen. Fill the required details like below and save it.
- After creating Plug-in Implementation, you need to configure it for which record types you want it to run. The best practice is to run the plug-in asynchronously. The following page will appear on the screen when you click on the Configure button on Plug-in implementation page.
You can configure this plugin for all the subsidiaries or for the subsidiaries that you want it to run. After setting up all the required details save the configuration.
- After configuration we need to enable this plug-in: Go to Customization→ Plug-ins → Manage Plug-ins →Enable the above-created plug-in
Enable the plug-in and click on the save button. Your plugin implementation is ready now.
For this case in the Invoice page we have created a “Commission Total” field which shows total commission amount. Based on value in the field, plug-in will create custom GL lines in the respective Invoice GL impact. Two lines for Commission and Commission Liability Accounts.Total two custom lines will be added after saving the Invoice record. Commission Lines will not be created when the “Commission Total” field has value as null or zero.
For each custom line that we are adding there should be one separate GL account. In case of commission amount, one line shows the “50301 Commissions” Account debit and another line shows “2033 Commissions Liability” Account Credit. So in order to balance the GL we need to set both debit and credit accounts. You can use any account from the chart of accounts to set debit and credit accounts in GL as per your requirement.
Custom GL Lines in action
Commission amount Field in Invoice
Please see the screenshot below. It shows the commission amount field.
Invoice GL Impact before enabling GL lines plug-in
Please see the screenshot below. It shows the GL Impact of an Invoice before enabling the GL lines plug-in.
Invoice GL Impact after enabling GL lines plug-in
Please see the screenshot below. It shows the GL Impact of an Invoice before enabling the GL lines plug-in.
Conclusion
If you have customized NetSuite ERP and want to have Custom GL impact – you can use Custom GL Lines Plug-in. Write in the comments below to give your feedback. To know more about our NetSuite customization services contact us – we are among the Leading NetSuite Partners.