Week 7 • Module 13

N/ui/message & N/ui/dialog

Displaying banners, alerts, and confirmation dialogs

📢 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

TypeAppearanceUse Case
CONFIRMATIONGreenSuccess messages
INFORMATIONBlueGeneral info
WARNINGYellowCaution alerts
ERRORRedError 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:

  1. Go to docs.oracle.com → SuiteScript 2.x Modules
  2. Click on N/ui/message Module for banner messages
  3. Click on N/ui/dialog Module for modal dialogs

Key pages to bookmark:

🎯 Key Takeaways