I have an input form I've created that runs in an html modal that opens via in Google App Script in a google sheet that takes values from the google sheet, that users can then edit or manipulate in the form, then write the changes back into the google sheet upon "submission".
I'm getting an issue where two specific users can't appear to use any functions that utilize google.script.run.function() way of calling any functions in the Code.gs file, and I was using that to read cells from the sheet, as well as write values from the form into the sheet.
In an attempt to narrow down if the error is in the function in Code.gs or in the html, I way over simplified my code to this:
TestWindow.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<script>
function testHtml(){
google.script.run.withSuccessHandler(function (){
window.alert("Sucess!");
})
.withFailureHandler(function (){
window.alert("Failed!");
}).testFunction();
}
</script>
<input type="button" id="submit" name="submit" value="Test Button" onclick="testHtml()">
</body>
</html>
Code.gs
function testFunction(){
Logger.log("This is a test");
}
function openTest(){
var ui = SpreadsheetApp.getUi();
var html = HtmlService.createHtmlOutputFromFile('TestWindow')
.setWidth(600)
.setHeight(800);
ui.showModalDialog(html, 'Test Window:');
}
Most of my users get the success handler response when clicking the test button, but I have 2 users who get the failure handler and the execution log in the Apps Script editor has 0 second duration executions of the "testFunction()" where the execution is un-expandable, with no error listed, just simply "Failed" in the status.
I have checked their version of Google Chrome, and had them update to the latest and still get the above error.
I checked the permission they gave, they have all of the same permissions that the other users agreed to, still get the above error.
My company has some users use a vpn to access certain things, and I connected to the same vpn and I don't get the fail handler on my computer.
All users are logged in as users within the same Google workspace organization, and I tested with my personal account rather than the company account within the organization that owns it, and my personal account responds with the success handler.
Are there possible Chrome settings that could prevent them from using google.script.run? Or possibly user settings that I'm not seeing are different? Is there a possibility that the asynchronous nature of google.script.run is not meshing well with their possibly much slower computers? (I tried adding delays into the code to accommodate some lag time, but no success there, plus the 0 second duration in the execution log leads me to believe that's not the problem). Most users are remote workers, all working on different networks. One of the users lives close to me, so I'm close to driving to their house to see if they still get the fail handler when the access the form logged in on my computer rather than theirs.