N/ui/message Module for Client Scripts in NetSuite

The N/ui/message module allows client scripts to create and display messages, enhancing user interactions in NetSuite.

·2 min read·View Oracle Docs

TL;DR: The N/ui/message module in NetSuite provides client scripts with the ability to create and display messages on the user interface. This feature enhances the interaction experience by facilitating notifications and feedback directly on the page.

What is the N/ui/message Module?

The N/ui/message module is a fundamental SuiteScript 2.x module that enables developers to create message notifications within client scripts. These messages can notify users of important information, confirmations, or warnings, enhancing the user experience.

Key Members of the N/ui/message Module

The N/ui/message module comprises the following essential members:

Member TypeNameReturn Type / Value TypeSupported Script TypesDescription
Objectmessage.MessagevoidClient scriptsRepresents the Message object that gets generated via the message.create(options) method.
Methodmessage.create(options)message.MessageClient scriptsCreates a message to be displayed or hidden at the top of the page.
Enummessage.TypeenumClient scriptsSpecifies the type of message (e.g., information, warning) to display, influencing its visual style.

How to Use message.create(options)

To create a message, you'll call the message.create method with an options parameter that specifies the message title, content, type, and duration. Below is a syntax example:

suitescript
1//Add additional code
2 var newMsg = message.create({
3 title: "New Message Title",
4 message: "This is an new informational message",
5 type: message.Type.INFORMATION
6 });
7 // newMsg is the message.Message object created
8//Add additional code

Options Parameter Explained

The options parameter allows customization of the message:

  • options.type: Required. Specifies the message type using the message.Type enum (e.g., INFORMATION, WARNING).
  • options.title: Optional. Sets the message title (defaults to an empty string).
  • options.message: Optional. The content of the message (defaults to an empty string).
  • options.duration: Optional. Determines how long the message should be displayed (default is 0, displaying until Message.hide() is called).

Who This Affects

This feature is significant for:

  • Developers: Enhances client-side scripting capabilities.
  • Administrators: Improves user interface notifications and guidance.
  • End Users: Gains better visibility into important alerts or confirmations.

Key Takeaways

  • The N/ui/message module allows for dynamic messaging in client scripts within NetSuite.
  • Messages can provide various types of notifications, influencing user interactions.
  • Customization options enhance how developers manage user feedback and alerts in real time.

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

Frequently Asked Questions (4)

Do I need to enable a feature flag to use the N/ui/message module?
No specific feature flag needs to be enabled to use the N/ui/message module. It is a standard module available for use in client scripts in SuiteScript 2.x.
Can the N/ui/message module specify how long a message is displayed?
Yes, the message duration can be specified using the options.duration parameter. If set to 0, the message remains until the Message.hide() method is called.
What types of messages can be displayed with the N/ui/message module?
The module supports various types of messages, including information and warnings, determined using the message.Type enum.
Is the N/ui/message module available for all users of NetSuite?
The module is available for use in client scripts, primarily affecting developers, administrators, and end users who interact with NetSuite's user interface.
Source: N/ui/message Members 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 SuiteScript

View all SuiteScript articles →