N/ui/serverWidget Module for Suitelet UI Customization
N/ui/serverWidget module enables Suitelets to build custom UI components like forms, fields, and sublists in NetSuite.
The N/ui/serverWidget module provides developers with tools to create and manage user interface components within NetSuite. Using Suitelets, you can design custom forms, fields, sublists, and wizards that adhere to the NetSuite aesthetic. This capability enhances user experience by enabling tailor-made interactions and functionalities.
Accessing the NetSuite UI
A key point to remember is that SuiteScript does not allow direct manipulation of the NetSuite UI through the Document Object Model (DOM). Instead, you should exclusively utilize the SuiteScript APIs to interact with the UI components.
When adding UI objects to existing NetSuite pages, ensure that any internal IDs referencing these objects are prefixed with custpage to avoid name conflicts.
Module Members Overview
The N/ui/serverWidget module encompasses various objects and methods that can be employed to enhance user interfaces. Here’s a brief overview of its members:
| Member Type | Name | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|---|
| Object | serverWidget.Assistant | Object | Suitelets | A scriptable, multi-step NetSuite assistant. |
| Object | serverWidget.Button | Object | Suitelets and beforeLoad user events | A button that appears in a UI object. |
| Object | serverWidget.Field | Object | Suitelets and beforeLoad user events | A standard field in NetSuite. |
| Object | serverWidget.Form | Object | Suitelets and beforeLoad user events | A basic form template. |
| Object | serverWidget.Sublist | Object | Suitelets and beforeLoad user events | A sublist for detailed entries. |
| Method | serverWidget.createForm(options) | serverWidget.Form | Suitelets | Creates and returns a new form object. |
| Method | serverWidget.createList(options) | serverWidget.List | Suitelets | Creates a new list object. |
Important Notes
- Be cautious when naming your objects to prevent conflicts with existing names.
- Take advantage of the various objects available in this module to create a cohesive user experience.
The flexibility of the N/ui/serverWidget module allows developers to streamline their custom Suitelet solutions and provide intuitive interactions within NetSuite, resulting in enhanced productivity and user satisfaction.
Key Methods and Properties Some additional important methods and properties include:
- Assistant Methods: Such as
Assistant.addField()andAssistant.addStep()for building out the assistant flow. - Field Methods: For manipulating fields such as
Field.addSelectOption()to dynamically add choices to dropdowns. - Form Methods: Such as
Form.addSublist()to include detailed records directly within forms.
Implement these tools and methods strategically to maximize the effectiveness of your Suitelets.
Key Takeaways:
- The N/ui/serverWidget module empowers developers to create custom UI elements in Suitelets without DOM access.
- Remember to use
custpageas a prefix for internal IDs to avoid conflicts. - Utilize the various objects and methods to enhance user interactions within the NetSuite environment.
Frequently Asked Questions (4)
Does the N/ui/serverWidget module allow manipulating the NetSuite UI directly through the DOM?
What is the recommended prefix for internal IDs when adding UI objects to avoid conflict in NetSuite?
Can serverWidget.Button be used in both Suitelets and user events?
Which method is used to create a new form object in the N/ui/serverWidget module?
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