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
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Home/ Real-World NetSuite Examples/Add a Running Total Field to a Sublist (Suitelet)

Add a Running Total Field to a Sublist (Suitelet)

🧩 Business Scenario

You’re building a Suitelet with an editable list of values β€” such as expense items, time entries, or project costs β€” and you’d like to automatically show a running total of the values entered into a currency field (like β€œAmount”).

NetSuite doesn’t calculate or display sublist totals by default in Suitelets. But using the updateTotallingFieldId() method, you can enable inline sublist totals, just like in standard NetSuite transaction records.


🧠 Objective

Create a Suitelet with:

  • A sublist in INLINEEDITOR mode
  • A custom currency field (amount) that automatically totals values
  • Multiple rows pre-populated with values
  • A running total visible at the bottom of the sublist

πŸ’» Script: Suitelet with Running Total on Sublist

/**
 * @NApiVersion 2.x
 * @NScriptType Suitelet
 */
define(['N/ui/serverWidget', 'N/record'], function(serverWidget, record) {
    return {
        onRequest: function(params) {
            var form = serverWidget.createForm({ title: 'Simple Form with Totals' });

            // Create the Sublist with Totals
            var sublist = form.addSublist({
                id: 'mylist',
                type: serverWidget.SublistType.INLINEEDITOR,
                label: 'Transaction Lines'
            });

            sublist.addField({
                id: 'description',
                type: serverWidget.FieldType.TEXT,
                label: 'Description'
            });

            sublist.addField({
                id: 'amount',
                type: serverWidget.FieldType.CURRENCY,
                label: 'Amount'
            });

            // Enable Totalling
            sublist.updateTotallingFieldId({
                id: 'amount'
            });

            // Prepopulate Sublist Rows
            sublist.setSublistValue({ id: 'description', line: 0, value: 'Design Fee' });
            sublist.setSublistValue({ id: 'amount', line: 0, value: '250.00' });

            sublist.setSublistValue({ id: 'description', line: 1, value: 'Consulting' });
            sublist.setSublistValue({ id: 'amount', line: 1, value: '500.00' });

            // Add a second dummy sublist to show multiple sections
            form.addSublist({
                id: 'dummy',
                type: serverWidget.SublistType.STATICLIST,
                label: 'Static Info'
            });

            // Render the Page
            params.response.writePage(form);
        }
    };
});

πŸ” Key Function: updateTotallingFieldId()

This special method enables automatic summation of a currency field at the bottom of the sublist. It does not calculate row-by-row running totals, but gives you a subtotal footer, similar to native transactions in NetSuite.

🧠 Important: This only works with INLINEEDITOR sublists and supported field types like CURRENCY, INTEGER, or FLOAT.


πŸ“Έ Visual Output (Simulated)

DescriptionAmount
Design Fee$250.00
Consulting$500.00
Total$750.00 βœ… (auto-calculated)

πŸ” Limitations

  • Only works with supported field types (currency, integer, float)
  • Total appears only at the bottom, not per-row
  • Requires INLINEEDITOR sublist type
  • Does not support dynamic total changes via client script β€” it’s calculated at render time

πŸ§ͺ Real Use Cases

Use CaseBenefit
Expense Form SuiteletTotals user-entered expenses
Commission Payout SheetShow total commissions
Project Line Item EstimatorDynamic total on client pricing sheet
Time Tracking SummaryTotal billable hours in editable list

πŸ’‘ Pro Tips

  • You can combine this with a Client Script to display live totals (e.g., updating a header field or status message).
  • For transaction-like behavior, pair this sublist with a Save button and server-side logic to process the entries.

πŸ“Œ Summary

By using updateTotallingFieldId() in a Suitelet sublist, you can offer immediate visual feedback to users β€” showing calculated totals right inside a custom form. This creates a more intuitive user experience for financial inputs, time entry logs, and internal tools.

Share
  • Facebook

Leave a ReplyCancel reply

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 5
  • 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
  • 22 Points
Begginer
Sophie1022

Sophie1022

  • 0 Questions
  • 20 Points
Begginer
jmargoli

jmargoli

  • 0 Questions
  • 20 Points
Begginer

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

Menu

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us

Quick Links

  • NetSuite Scripting
  • NetSuite Customization
  • NetSuite Advanced PDF Template
  • NetSuite Integration
  • NetSuite Reporting & Analytics

Subscribe for NetSuite Insights....

© 2025 The NetSuite Pro. All Rights Reserved