dialog.create(options)
Method Description |
Creates a dialog with specified buttons. |
Returns |
Promise Object. To run a callback function when a button is pressed, pass a function to the then portion of the Promise object. The value of the button pressed is passed to the callback. |
Supported Script Types |
Client scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2016.1 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string[] |
optional |
A list of buttons to include in the dialog. Each item in the button list must be a Javascript Object that contains a label and a value property. By default, a single button with the label OK and the value true is used. |
2016.1 |
|
string |
optional |
The dialog title. This value defaults to an empty string. |
2016.1 |
|
string |
optional |
The content of the dialog. This value defaults to an empty string. |
2016.1 |
Errors
Error Code |
Error Message |
Thrown If |
---|---|---|
|
Wrong parameter type: {1} is expected as {2}. |
The |
|
Buttons must include both a label and value. |
The |
Syntax
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 Dialog with 3 custom buttons',
message: 'Click a button to continue.',
buttons: [
{ label: '1', value: 1 },
{ label: '2', value: 2 },
{ label: '3', value: 3 }]
};
function success(result) { console.log('Success with value: ' + result) }
function failure(reason) { console.log('Failure: ' + reason) }
dialog.create(options).then(success).catch(failure);
...
//Add additional code
The following screenshot shows an example of a Custom dialog with three buttons:

If no buttons are specified, a single value with the label OK is used:
//Add additional code
...
dialog.create({
title: 'I am a Dialog with the default button',
message: 'Click a button to continue.'
});
...
//Add additional code
