How to Customize Pop-Up Dialogue Boxes in NetSuite

by | Mar 29, 2022 | Tech Talk

Adding a pop-up dialogue box to suitescript that displays a message to the end-user is an easy way to help ensure messages are acknowledged.  This function can be quite useful in situations when you wish to either alert a user to a particular situation when validating a record, force them to acknowledge information regarding the current record they are viewing, or even control the flow of a process within a client script.  In any of these cases, the dialogue box function can be embedded into client scripts to meet those needs. If you have any query, contact NetSuite consultants.

This very basic scenario generates an informational alert to the user when a record is loaded in NetSuite.  In our example, the pop-up dialogue box will appear when the user creates a new Lead in NetSuite.

The first thing to note is the script must include the reference to the N/ui/dialog module within the client script to access the dialog.alert method in NetSuite. 

The method includes the below two parameters that can be customized to include any message content that is required, whether it is a static message or a dynamic message that concatenates multiple variables into the display message.

options.titlestringoptionalThe alert dialog title. This value defaults to an empty string.
options.messagestringoptionalThe content of the alert dialog. This value defaults to an empty string.

Here is the code snippet example that we can add to any function within the client script to display the pop-up dialogue box.  In this example I embedded this into a client script pageInit method and created a deployment for this script to execute when a Lead record is initialized in NetSuite.

function success(result) { console.log('Success with value: ' + result) } 
function failure(reason) { console.log('Failure: ' + reason) } 

dialog.alert({
title: 'This is an alert.',
message: 'Click OK to continue.' 
}).then(success).catch(failure);

With the script deployed, when I open a lead record in create/view/edit mode this dialogue box will appear.

Follow us as we explore additional uses of the pop-up dialogue within NetSuite.

About Us

We are a NetSuite Solutions Partner and reseller with 30+ years of combined experience.  We specialize in implementation, optimization, integration, rapid project recovery and rescue as well as custom development to meet any business need. If you would like more information on NetSuite or in need of consultation for your project or implementation, feel free to contact with NetSuite support.

To Contact Us Click Here

Join our mailing list to stay up to date on the latest NetSuite solutions.