Message Object Members
Discover the Message object methods in SuiteScript, enabling effective message display and management in client scripts.
The Message object in SuiteScript provides developers with methods to manage notifications displayed to users. It allows you to show or hide messages dynamically, enhancing user interaction with applications. Understanding how to utilize these methods is essential for effective client-side scripting.
What Are the Message Object Members?
The Message object includes members that define how messages are shown and hidden within SuiteScript client scripts. Here’s a breakdown of its primary methods:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Message.hide() | void | Client scripts | Hides the currently displayed message. |
Message.show(options) | void | Client scripts | Displays a message with optional parameters. |
How Does Message.show(options) Work?
The Message.show(options) method displays a message in the UI. Here is what you need to know:
- Parameters: The
optionsparameter is a JavaScript object that can include:duration: (optional) Duration to display the message in milliseconds. If set to0, the message remains visible until it is manually hidden.
- Error Handling: If the duration provided is not a number or string that can be parsed, an error with the code
WRONG_PARAMETER_TYPEis thrown.
Code Example for Showing a Message
Here's a simple code snippet that showcases how it works:
1// Example script to create and show a message2var myMsg = message.create({3 title: "My Title 2", 4 message: "My Message 2", 5 type: message.Type.INFORMATION6});7myMsg.show({ duration: 1500 }); // Shows the message for 1500msHow Does Message.hide() Work?
The Message.hide() method hides the currently displayed message. It doesn't return any value and is essential for managing the user interface dynamically, especially when using timed displays or responding to user actions.
Code Example for Hiding a Message
Below is an example demonstrating how to hide a message:
// Example script to hide a message after a delaysetTimeout(function() { myMsg.hide(); // Hides the message after 15 seconds}, 15000);Summary of Key Features
- The Message object enhances user experience by allowing notifications via messages.
- Both methods
show()andhide()are easy to implement and critical for effective user interface management in SuiteScript.
Who This Affects
- Administrators: Responsible for implementing client scripts and managing UI messages.
- Developers: Utilize the Message object methods for creating dynamic applications.
Source: This article is based on Oracle's official NetSuite documentation.
Key Takeaways
- The Message object enables show/hide functionality for messages in SuiteScript.
- Customize message duration to control user notifications effectively.
- Error handling is essential when using parameters in message methods.
Frequently Asked Questions (4)
Do I need special permissions to use the Message object in client scripts?
Can the 'Message.show(options)' method display a message indefinitely?
What happens if I provide a non-numeric value for the duration parameter in 'Message.show(options)'?
Is there a method to check if a message is currently displayed using the Message object?
Was this article helpful?
More in General
- Payment Date Prediction Feature in NetSuite
Payment Date Prediction in NetSuite utilizes machine learning to enhance financial planning by predicting invoice payment dates.
- NetSuite Ship Central Enhancements for Packing & Shipping
NetSuite Ship Central features enhance packing and shipping operations for improved efficiency and accuracy.
- Generative AI Features in NetSuite 2026.1
Discover new generative AI features in NetSuite 2026.1, enhancing reporting, search, predictions, and development productivity.
- Field Service Management Enhancements and Bug Fixes for 2026
Overview of the 2026 Field Service Management SuiteApp updates showcasing enhancements and bug fixes.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category