Adding Sublists with SuiteScript in NetSuite

Add functional sublists to your SuiteScript forms using the serverWidget module's capabilities.

·2 min read·View Oracle Docs

TL;DR Opening

This article explains how to add sublists to forms and assistants in SuiteScript using the serverWidget module. This is crucial for customizing user interfaces in NetSuite, enhancing data entry workflows, and providing better user experiences.

What is a Sublist?

A sublist is a component that can be added to a serverWidget.Form or a serverWidget.Assistant object in NetSuite. It allows you to display and manage related records or information within a form or assistant layout. The sublist can show data such as line items, related records, etc., and improves the usability and layout of forms.

How to Add a Sublist?

To add a sublist, you can use one of the following methods:

  • Assistant.addSublist(options)
  • Form.addSublist(options)

Note: The sublist object is read-only except when created through Suitelets or beforeLoad user event scripts.

Supported Script Types

Sublists can be used in the following script types:

  • Suitelets
  • User event scripts (specifically during the beforeLoad entry point)

These types provide flexibility when creating interfaces in NetSuite.

The serverWidget Module

The sublist functionality is part of the N/ui/serverWidget Module. This module allows developers to create and manipulate server-side UI components in SuiteScript.

Example Syntax

The following code snippet demonstrates how to add a sublist to a form:

suitescript
1//Add additional code
2...
3var form = serverWidget.createForm({
4 title : 'Simple Form'
5});
6var sublist = form.addSublist({
7 id : 'sublist',
8 type : serverWidget.SublistType.INLINEEDITOR,
9 label : 'Inline Editor Sublist'
10});
11...
12//Add additional code

This code illustrates the integration of a sublist with a basic form. The type field illustrates how to define the behavior of the sublist (in this case, an inline editor).

Who This Affects

  • Developers: Those looking to customize user interfaces in NetSuite using SuiteScript.
  • Administrators: Administrators implementing features that require sublists in Suitelets or forms.

Key Takeaways

  • Sublists enhance data management on forms and assistants in NetSuite.
  • Utilize the serverWidget module for all relevant UI customizations.
  • They can be leveraged in Suitelets and beforeLoad user event scripts only.
  • Proper syntax is essential for successful implementation.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Which script types support adding sublists using SuiteScript?
Sublists can be added using Suitelets and user event scripts, specifically during the beforeLoad entry point.
Is it possible to modify a sublist after it has been added to a form in SuiteScript?
No, the sublist object is read-only except when it is created through Suitelets or beforeLoad user event scripts.
What module do I use in SuiteScript to add a sublist to a form?
You use the N/ui/serverWidget module to add and manage sublists within SuiteScript forms.
What prerequisites are required to add a sublist to a form using SuiteScript?
You need to use either Suitelets or user event scripts (beforeLoad) since these script types support sublist creation.
Source: Syntax Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in User Interface

View all User Interface articles →