Create a Confirmation Dialog

The following sample shows how to create a confirmation dialog.

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 Confirmation',
        message: 'Press OK or Cancel'
    };

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

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

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

        

General Notices