To get around the fact you can't pop user dialogue windows on mobile devices, I have created a simple function which posts any error messages to a cell and waits for the user to check a checkbox to confirm they have read the message. Once the checkbox is checked, the message and the checkbox are removed:
function messageHandler (mssg, mssgType) {
sheet.getRange('D7').setValue(mssg);
sheet.getRange('I7').activate();
sheet.getActiveRangeList().insertCheckboxes();
/*while (sheet.getRange('I7').getValue() !== true) {
window("checkbox value is "+sheet.getRange('I7').getValue());
Utilities.sleep(3000);
}*/
do {
window("checkbox value is "+sheet.getRange('I7').getValue());
Utilities.sleep(3000);
} while (sheet.getRange('I7').getValue() !== true);
sheet.getRangeList(['D7','I7']).activate();
sheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
}
As you can see, I tried both while and do loops, but in both cases, the value of the checkbox is always FALSE, even after checked by the user, so the function never completes.
Is the checkbox only ever evaluated once? Do I need to add a check to my onEdit() trigger?
messageHandlerfunction, it executes once on the server. This means thatsheet.getRange('I7').getValue()only reads the value at the moment the script is executing.I7until the script times out. That's in 30 seconds or 6 minutes depending on context. But that's not a very good way to detect a checkbox click.windowandsheetareundefined.