The N/ui/dialog module lets Client Scripts show native-looking dialog boxes β alerts, confirmations, and custom dialogs β directly in the NetSuite UI. It is used for user prompts, confirmation gates, and informational messages.
Showing an Alert
define(["N/ui/dialog"], (dialog) => {
const saveRecord = (context) => {
dialog.alert({ title: "Saved!", message: "The record has been saved successfully." });
return true;
};
return { saveRecord };
});
Showing a Confirmation Dialog
dialog.confirm({
title: "Are you sure?",
message: "This action cannot be undone."
}).then((confirmed) => {
if (confirmed) {
log.debug("User confirmed", "Proceeding...");
} else {
log.debug("User cancelled", "Stopping.");
}
});
Key Methods
| Method | Description |
|---|---|
dialog.alert(options) | Show a message with an OK button (returns Promise) |
dialog.confirm(options) | Show OK/Cancel dialog (resolves to true/false) |
dialog.create(options) | Create a custom dialog with buttons and fields |