📢 N/ui/message Module
Display banner messages at the top of the page (Client Scripts only).
const message = require('N/ui/message');
// Create and show a message
const myMsg = message.create({
title: 'Success!',
message: 'Record saved successfully.',
type: message.Type.CONFIRMATION
});
myMsg.show();
// Auto-hide after 5 seconds
myMsg.show({ duration: 5000 });Message Types
| Type | Appearance | Use Case |
|---|---|---|
| CONFIRMATION | Green | Success messages |
| INFORMATION | Blue | General info |
| WARNING | Yellow | Caution alerts |
| ERROR | Red | Error notifications |
💬 N/ui/dialog Module
Show modal dialogs for user interaction.
dialog.alert()
const dialog = require('N/ui/dialog');
dialog.alert({
title: 'Notice',
message: 'Please review the data before continuing.'
});dialog.confirm()
dialog.confirm({
title: 'Confirm Action',
message: 'Are you sure you want to proceed?'
}).then(result => {
if (result) {
// User clicked OK
processRecord();
} else {
// User clicked Cancel
log.audit('Cancelled', 'User cancelled the action');
}
});💡 Promise-Based
dialog.confirm() returns a Promise. Use .then() to handle the user's response. True = OK clicked, False = Cancel clicked.
📖 Finding This in the Docs
To look up message and dialog APIs:
- Go to docs.oracle.com → SuiteScript 2.x Modules
- Click on N/ui/message Module for banner messages
- Click on N/ui/dialog Module for modal dialogs
Key pages to bookmark:
- message.create(options) → type (CONFIRMATION, INFORMATION, WARNING, ERROR)
- Message.show() / Message.hide() → display control
- dialog.alert(options) → simple notification popup
- dialog.confirm(options) → returns Promise with user response
- dialog.create(options) → custom dialogs with buttons
🎯 Key Takeaways
- message.create() creates banner messages (CONFIRMATION, INFORMATION, WARNING, ERROR)
- message.show() displays the banner; optional duration for auto-hide
- dialog.alert() shows informational popups
- dialog.confirm() returns a Promise with the user's choice
- Both modules are Client Script only (browser-side)