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:

  • Input to methods that set the custom line amount is not non-numerical.

  • Script file does not access non-existent standard lines.

  • Each custom line contains an amount and an account ID.

  • Statistical account IDs are not used for account IDs.

  • IDs for accounts, departments, classes, and locations exist in the current NetSuite account.

  • Debits and credits on the GL impact lines balance.

  • Currency type for the account matches the base currency for the subsidiary entity or matches the currency for the transaction.

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 getCount() method to return the number of visible lines

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.

                    if((debitAmount !=0 || creditAmount !=0) && accountId != null) {
    // normal visible lines
} 

                  

Or use the following shorter version.

                    if((debitAmount || creditAmount) && accountId) {
    // normal visible lines
} 

                  

Governance Limit

The plug-in script file allows up to 1000 usage units. For more information, see Script Type Usage Unit Limits.

Related Topics

Custom GL Lines Plug-in Example Code
Classifications
Multiple Currencies Examples
Error Messages for Custom GL Lines Plug-in
Custom Lines on Reports and in Searches
Custom GL Lines Audit Log
Reviewing Custom GL Lines Plug-in Executions
Deleting a Custom GL Lines Plug-in Implementation

Additional Information

Custom GL Lines Plug-in Implementation Development
Custom GL Lines Plug-In Interface Definition

General Notices