title: SpreadsheetApp.getUi() operation not supported?
body: <p>Trying to add a confirmation dialog when a user clicks a menu item, I am following this Google page almost to the letter: <a href="https://developers.google.com/apps-script/guides/dialogs#alert_dialogs" rel="nofollow">https://developers.google.com/apps-script/guides/dialogs#alert_dialogs</a></p>
  
  <p>However, I am getting a "This operation is not supported" error message. In the Execution Transcript, I see this:</p>
  
  <pre><code>[14-02-10 12:21:54:551 EST] Starting execution
  [14-02-10 12:21:55:550 EST] Execution failed: This operation is not supported (line 28, file "Code") [0.226 seconds total runtime]
  </code></pre>
  
  <p>Line 28 in "Code" is the second line of the function below:</p>
  
  <pre><code>function sendMergedMail() {
    var ui = SpreadsheetApp.getUi();
    var result = ui.alert(
       'Please confirm',
       'Are you sure you want to continue?',
        ui.ButtonSet.YES_NO);
    if (result != ui.Button.YES) {
      return
    }
  
    var doc = SpreadsheetApp.getActiveSpreadsheet();
    doc.toast("Current sheet: "+doc.getName());
  };
  </code></pre>
  
  <p>Thank you!</p>