Stay organized with collections
Save and categorize content based on your preferences.
ButtonSet
An enum representing predetermined, localized sets of one or more dialog buttons that can be
added to an alert or a prompt. To determine which button the user clicked,
use Button.
To call an enum, you call its parent class, name, and property. For example,
Base.ButtonSet.OK.
// Display a dialog box with a message and "Yes" and "No" buttons.
const ui = DocumentApp.getUi();
const response = ui.alert(
'Are you sure you want to continue?',
ui.ButtonSet.YES_NO,
);
// Process the user's response.
if (response === ui.Button.YES) {
Logger.log('The user clicked "Yes."');
} else {
Logger.log('The user clicked "No" or the dialog\'s close button.');
}
Properties
Property
Type
Description
OK
Enum
A single "OK" button, indicating an informational message that can only be dismissed.
OK_CANCEL
Enum
An "OK" button and a "Cancel" button, allowing the user to either proceed with or halt an
operation.
YES_NO
Enum
A "Yes" button and a "No" button, allowing the user to answer a yes/no question.
YES_NO_CANCEL
Enum
A "Yes" button, a "No" button, and a "Cancel" button, allowing the user to either answer a
yes/no question or halt an operation.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-26 UTC."],[[["`ButtonSet` is an enum used to create predefined, localized button sets for dialog boxes in Apps Script."],["It provides options like `OK`, `OK_CANCEL`, `YES_NO`, and `YES_NO_CANCEL` for different dialog scenarios."],["You can determine the user's button click by comparing the response to `ui.Button` values."],["These button sets are used with `alert()` and `prompt()` methods of the `Ui` class."]]],[]]