March 2016
Beginner to intermediate
232 pages
4h 29m
English
Logging the values of variables at a few points is essential when testing and debugging your code. The Logger class is a helpful tool to do this and has a few methods that are essential to debug your code.
Update the showDialog function as shown here:
function showDialog() {
var ui = DocumentApp.getUi();
var response = ui.prompt(
'Greeting', 'Will you enter your name below?', ui.ButtonSet.YES_NO
);
if (response.getSelectedButton() == ui.Button.YES) {
Logger.log('Your name is %s.', response.getResponseText());
} else if (response.getSelectedButton() == ui.Button.NO) {
Logger.log('You clicked \'NO\' button');
} else {
Logger.log('You closed the dialog.');
}
}Run the showDialog function as usual from the Add-ons menu. Do anything, ...
Read now
Unlock full access