dialog.alert(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Creates an Alert dialog with an OK button.

Returns

Promise Object. To run a callback function when the OK button is clicked, pass a function to the then portion of the Promise object. When the OK button is clicked, true is passed to the callback. You do not have to use the Promise object unless there is an action you want performed after the user clicks the OK button.

Supported Script Types

Client scripts

For more information, see SuiteScript 2.x Client Script Type.

Governance

None

Module

N/ui/dialog Module

Since

2016.1

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.title

string

optional

The alert dialog title. This value defaults to an empty string.

2016.1

options.message

string

optional

The content of the alert dialog. This value defaults to an empty string.

2016.1

Syntax

Important:

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see N/ui/dialog Module Script Samples.

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

        dialog.alert({
            title: 'I am an Alert',
            message: 'Click OK to continue.' 
        }).then(success).catch(failure);
        ...
         //Add additional code 

          

The following screenshot shows an example of an Alert dialog:

A dialog with an I am an Alert title and an OK button.

Related Topics

N/ui/dialog Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices