Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer peopleโ€™s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer peopleโ€™s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Home/ NetSuite Scripting/Custom GL Plugins in NetSuite

Custom GL Plugins in NetSuite

๐Ÿ”น What are Custom GL Plugins?

Custom GL Plugins in NetSuite allow developers to manipulate how transactions post to the General Ledger (GL).
By default, NetSuite posts accounting entries based on its internal logic. But sometimes, businesses need custom rules โ€“ for example:

  • Redirecting revenue accounts based on customer type.
  • Splitting costs into multiple GL accounts dynamically.
  • Recording additional lines for reporting or compliance.

This is where Custom GL Lines Plug-ins (GL Impact plug-ins) come in.


๐Ÿ”น Why Use Custom GL Plugins?

  • Override standard GL impact of transactions.
  • Automate revenue allocation, tax handling, or intercompany adjustments.
  • Improve reporting accuracy.
  • Reduce manual journal adjustments.

๐Ÿ”น Key Points to Remember

  • The plug-in type is Custom GL Lines (customscript_gl_plugin).
  • The entry point methods include:
    • generateLines(context) โ†’ Define new GL lines.
    • modifyLines(context) โ†’ Change existing GL lines.
    • reverseLines(context) โ†’ Reverse lines in specific cases.

๐Ÿ”น Example: Redirecting Revenue Based on Subsidiary

Below is a simple example of a Custom GL Lines Plug-in.

/**
 * @NApiVersion 2.x
 * @NScriptType CustomGLPlugin
 * @NModuleScope Public
 *
 * Example: Redirect revenue accounts based on subsidiary
 */
define(['N/log'], function (log) {
    function CustomGLPlugin() { }

    /**
     * Generate additional GL lines
     * @param {Object} context - Contains transaction and standard GL lines
     */
    CustomGLPlugin.prototype.generateLines = function (context) {
        try {
            var transaction = context.transactionRecord;
            var subsidiary = transaction.getValue({ fieldId: 'subsidiary' });

            // Loop through standard GL lines
            context.standardLines.iterator().each(function (line) {
                var accountId = line.getAccountId();

                // Example: Redirect revenue to custom account if subsidiary = 2
                if (subsidiary == 2 && line.creditAmount > 0) {
                    var customLine = context.lines.addNewLine();
                    customLine.setAccountId(1234); // custom revenue account
                    customLine.setCreditAmount(line.creditAmount);
                    customLine.setMemo("Redirected Revenue for Subsidiary 2");

                    // Neutralize original line
                    line.setCreditAmount(0);
                }

                return true;
            });
        } catch (e) {
            log.error('Error in generateLines', e);
        }
    };

    return CustomGLPlugin;
});

๐Ÿ” Explanation of the Code

  • context.transactionRecord โ†’ Accesses the transaction triggering the GL plugin (e.g., Invoice, Sales Order).
  • context.standardLines.iterator() โ†’ Iterates through the default GL lines created by NetSuite.
  • line.setCreditAmount(0) โ†’ Neutralizes the original credit line so it wonโ€™t double-post.
  • context.lines.addNewLine() โ†’ Adds your custom GL line.
  • Error Handling โ†’ try...catch block logs errors safely.

๐Ÿ”น Example Use Cases

  1. Multi-Subsidiary Accounting โ†’ Redirect revenue/expense accounts per subsidiary.
  2. Tax Adjustments โ†’ Add custom lines for tax reporting.
  3. Commission Splits โ†’ Post additional GL entries for sales commissions.
  4. Deferred Revenue โ†’ Move revenue into deferral accounts dynamically.

๐Ÿ”น Best Practices

โœ… Always neutralize standard lines if you replace them.
โœ… Test thoroughly in sandbox before production.
โœ… Keep plug-ins modular so you can maintain easily.
โœ… Add logs and error handling for traceability.


โœ… Summary

Custom GL Plug-ins are powerful for tailoring NetSuiteโ€™s accounting engine. They allow businesses to override, add, or redirect accounting lines automatically, ensuring compliance and accuracy without manual intervention.

Share
  • Facebook

Leave a ReplyCancel reply

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuiteโ€™s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 21 Points
Begginer
admin

admin

  • 5 Questions
  • 2 Points

Trending Tags

clientscript netsuite scripting suitescript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

© 2025 The NetSuite Pro. All Rights Reserved