Create a Dialog that Includes a Default Button

The following sample shows how to create a dialog without specifying any buttons. The default behavior is to create a dialog that includes a single button with the label OK.

Note:

This script sample uses the define function, which is required for an entry point script (a script you attach to a script record and deploy). You must use the require function if you want to copy the script into the SuiteScript Debugger and test it. For more information, see SuiteScript 2.x Global Objects.

Note:

To debug client scripts like the following, you should use Chrome DevTools for Chrome, Firebug debugger for Firefox, or Microsoft Script Debugger for Internet Explorer. For information about these tools, see the documentation provided with each browser. For more information about debugging SuiteScript client scripts, see Debugging Client Scripts.

Important:

This sample uses SuiteScript 2.1. For more information, see SuiteScript 2.1.

          /**
 * @NApiVersion 2.1
 */
define(['N/ui/dialog'], (dialog) => {
    let options = {
        title: 'I am a Dialog with the default button',
        message: 'Click a button to continue.',
    };

    function success(result) {
        console.log('Success with value ' + result);
    }

    function failure(reason) {
        console.log('Failure: ' + reason);
    }

    dialog.create(options).then(success).catch(failure);
}); 

        

General Notices