Adding Sublists with ServerWidget in SuiteScript for NetSuite
Learn to add sublists to SuiteScript forms, enhancing user interfaces and improving data entry workflows.
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:
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 codeThis 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
serverWidgetmodule for all relevant UI customizations. - They can be leveraged in Suitelets and beforeLoad user event scripts only.
- Proper syntax is essential for successful implementation.
Frequently Asked Questions (4)
Which script types support adding sublists using SuiteScript?
Is it possible to modify a sublist after it has been added to a form in SuiteScript?
What module do I use in SuiteScript to add a sublist to a form?
What prerequisites are required to add a sublist to a form using SuiteScript?
Was this article helpful?
More in SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category