Custom GL Lines Plug-in Guidelines and Best Practices
The following table describes guidelines and best practices for working with the Custom GL Lines plug-in:
Guidelines |
Description |
---|---|
Verify environment |
Perform the following checks to verify the environment and define plug-in implementation behavior based on the results:
You can use this information to define the plug-in behavior for the types of transactions configured for the implementation and how the custom lines should be created. |
Account and amount |
At minimum, each custom line created by the plug-in implementation must contain an account ID and an amount for the custom line. See setAccountId(accountId) and one of the following methods: setCreditAmount(credit) or setDebitAmount(debit). |
Utility files |
Use utility files to include helper functions that assist in defining plug-in implementation behavior. See Utility Files for a Custom GL Lines Plug-In Implementation. |
Validations |
NetSuite performs the following validations on the logic in the plug-in implementation script file when the script runs:
|
Transaction must balance |
The total amount of debits and credits for the transaction must balance. Each plug-in implementation only runs on the subsidiary for the current entity. You cannot distribute credits and debits across subsidiaries. |
Using the main line |
The first line in the StandardLines object, Line 0, is a summary line that contains the total amount of credits and debits for the transaction. The account ID for the main line depends on the transaction properties, line items, and accounting book. You can use this account ID when setting the account ID for a new custom line. |
Creating new versions |
To update an existing, installed version of a plug-in implementation, you should create a new implementation of the plug-in with a different name, instead of pushing an update to the existing plug-in implementation. |
Searching instead of loading records |
You can use SuiteScript API functions in a plug-in implementation, for example, nlapiLoadRecordType(type, id, initializeValues) and nlapiSearchRecord(type, id, filters, columns). For more information, see SuiteScript 1.0 API Reference. However, using these APIs may negatively affect the performance of the plug-in implementation. Limit the use of these APIs, where possible, to improve performance of the plug-in implementation. In general, searching for records yields better performance than loading NetSuite records. |
Creating records or performing data processing |
You should limit the logic of a plug-in implementation to the features required to create custom lines on the GL impact. Additional functionality, for example, creating records or performing other complex data processing operations, should not be added to the plug-in implementation script file. |
Using the |
By default, the getCount() method returns the number of visible and hidden lines on the GL Impact page. If you want to find only the number of visible lines, use the following condition.
Or use the following shorter version.
|
Governance Limit
The plug-in script file allows up to 1000 usage units. For more information, see Script Type Usage Unit Limits.