browser alerts and message box stopped working

24 views
Skip to first unread message

Wilson Galter

unread,
Jul 30, 2021, 7:00:24 AM7/30/21
to Google Apps Script Community
Hello,
Has anything changed in the last few days with apps script browser popup messages? None of the browser popup alert or confirm messages are working anymore.
something as simple as:

function testMsg(){
alert("This is a test")
or 
function saveOrNot(){

var answer = confirm("PLEASE CONFIRM YES or NO")
if (answer){doSomething()
    }
    else{alert('USER CLICKED NO')
}
       }

Is this deprecated now?

Dilshan Madushanka

unread,
Jul 30, 2021, 10:55:14 AM7/30/21
to Google Apps Script Community
As far as I know, the native alert was never worked on the apps script. You must use UI methods like

SpreadsheetApp.getUi().alert('This is a test');

 or

const ui = SpreadsheetApp.getUi();
  const response = ui.alert("Are you sure?", ui.ButtonSet.YES_NO);
  if(response === ui.Button.YES) {
    // yes work
  } else {
    // no work
  }
Reply all
Reply to author
Forward
0 new messages