dialog.confirm(options)

Method Description

Creates a Confirm dialog with OK and Cancel buttons.

Returns

Promise Object. To run a callback function when the OK button is pressed, pass a function to the then portion of the Promise object. The value of the pressed button, where OK is true and Cancel is false, is passed to the callback.

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 confirmation dialog title. This value defaults to an empty string.

2016.1

options.message

string

optional

The content of the confirmation 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 
...
var 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);  

...
//Add additional code 

          

The following screenshot shows an example of a Confirmation dialog:

A dialog with an I am a Confirmation title, an OK button, and a Cancel button.

Related Topics

General Notices