Plug-in Implementation Script File Creation for SuiteScript 1.0
You can use the SuiteCloud IDE, or any JavaScript IDE or text editor, to create the JavaScript file with your business logic for the Custom GL Lines plug-in implementation.
The following table describes the functions and objects available in a Custom GL Lines plug-in implementation script file:
Function / Interface Object |
Description |
---|---|
customizeGlImpact(transactionRecord, standardLines, customLines, book) |
You'll need to create an implementation of this function in the plug-in script file. The script can contain other helper functions. NetSuite runs this function when you save a transaction of the type and subsidiary you set up for the plug-in implementation. NetSuite runs this function one time for the primary accounting book. If you use Multi-Book Accounting, it also runs for each secondary accounting book you set up for the plug-in implementation. |
Contains an array of all standard lines with GL impact in a transaction as StandardLine objects. Use the methods available to this object to access the properties of each standard line with GL impact on a transaction. |
|
Contains an array of all custom lines with GL impact in a transaction as CustomLine objects. Use the methods available to this object to add and change custom lines with GL impact on a transaction. |
|
Represents the accounting book passed to a Custom GL plug-in implementation when you save a transaction. Use the methods available to the book object to determine if the book is a primary or secondary book or get the internal NetSuite ID of the accounting book. |
|
Use this to access properties of the transaction with SuiteScript API nlobjRecord functions. You can't modify the transaction. When you create a new transaction in synchronous mode, the record ID isn't available. |
For more information, see the Custom GL Lines Plug-in Process Flow and Custom GL Lines Plug-in Implementation Object Model for SuiteScript 1.0.
Custom GL Lines Plug-in Implementation Object Model for SuiteScript 1.0
The following diagram shows the object model for the interface input and output objects:
Rules and Guidelines
Use the following rules and guidelines when creating the plug-in implementation script file:
-
The plug-in script file can have any name, provided it has an implementation of the interface function.
-
If you want to create utility files with helper functions for the main implementation file, you can include them when you create the plug-in implementation for the Custom GL Lines plug-in in NetSuite. For more information about utility files, see Utility Files for a Custom GL Lines Plug-In Implementation.
-
You can use a custom record type to store the references to the required NetSuite standard records. See Using a Custom Record to Reference Internal NetSuite IDs Example.
-
You can use SuiteScript API functions in a plug-in implementation, for example, nlapiLoadRecord(type, id, initializeValues) and nlapiSearchRecord(type, id, filters, columns). For more information, see SuiteScript 1.0 API Reference and SuiteScript 2.x API Reference. However, using these APIs may slow down your plug-in, so try to use them only when needed to improve performance of the plug-in implementation. For better performance searching for records is better than loading NetSuite records.
These functions also have governance limits. The plug–in script file lets you use up to 1000 usage units with SuiteScript. For more information, see SuiteScript 1.0 API Governance in SuiteScript 1.0 and SuiteScript 2.x API Governance.
For additional guidelines and best practices, see Custom GL Lines Plug-in Guidelines and Best Practices.