Modal window issues

183 views
Skip to first unread message

Andrew Apell

unread,
Oct 20, 2020, 7:34:03 AM10/20/20
to Google Apps Script Community
Hi guys.
Is there anyone having trouble displaying modal windows in Google Sheets?
Say, when someone clicks a menu item, it just displays the "loading" message but the window never appears.
What could be the cause?

Andrew Roberts

unread,
Oct 20, 2020, 8:29:29 AM10/20/20
to google-apps-sc...@googlegroups.com
Disabling V8 is probably the first thing to try.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/1b832772-2aff-4421-8b14-c6daaebb8a7bn%40googlegroups.com.

Alan Wells

unread,
Oct 20, 2020, 8:53:53 AM10/20/20
to Google Apps Script Community
The first thing you should always ask is:
"Did I just change something?"
If you did, then the probability is very high that it came from the code you just changed.
But, you didn't state whether anything was changed or not.
It could be:


- an authorization issue.
- server code parsed wrong
- client side code parsed wrong

If the menu was built, then I'm guessing that it was built from a "simple" onOpen() function.
A simple trigger doesn't require authorization.
Loading the dialog does require authorization for prompts and dialogs.
The authorization could have been lost somehow.

If the client side code was parsed incorrectly,
you should have an error in the browser developer tools console log when the code runs
that there was an uncaught error.

If there was a server code failure then you  might have a failed execution in your executions list.
Those are the basics.
We don't know if you did the basic work to try to find the problem yourself.

Andrew Apell

unread,
Oct 20, 2020, 9:45:07 AM10/20/20
to Google Apps Script Community
Thanks or the tips guys.
Turning off V8 is not an option for me; V8 has brought me some good benefits.
I didn't change anything in the code and this error is reported randomly... I guess I closer look at the error logs is what's left now.
As far as I know, there are no authorization issues that could be causing the conflict; the code is quite simple.

Darren D'Mello

unread,
Oct 20, 2020, 10:55:00 AM10/20/20
to google-apps-sc...@googlegroups.com
It could also be due to Global variables issue. Do you use any libraries?



--
Best,
Darren

Andrew Apell

unread,
Oct 20, 2020, 11:56:09 AM10/20/20
to Google Apps Script Community
I don't use any libraries but I have one global variable

Alan Wells

unread,
Oct 20, 2020, 12:28:04 PM10/20/20
to Google Apps Script Community
Use an Immediately Invoked Function Expression (IIFE) to define your global.

(function(){
  
  /*IMPORTANT -
    Do NOT use the "var" key word to define the variable name -
    If a variable is assigned a value without a var key word then it is put into the globlal scope -
    Global variables can cause a fatal error during the parsing of the JavaScript before the code is even run -
    If that happens then your code will never run -
    Globals can stop the add-on menu from being displayed -
    So setting the globals correctly is extremely important -
  */
 
  TEST_GLBL = "SOMTHING";
 
  //Logger.log('TEST_GLBL inside IIFE: ' + TEST_GLBL)
  
})();

Andrew Apell

unread,
Oct 20, 2020, 12:45:42 PM10/20/20
to Google Apps Script Community
.... interesting solution; thanks!
Message has been deleted

Clark Lind

unread,
Apr 1, 2021, 8:46:45 AM4/1/21
to Google Apps Script Community
Also make sure you are using an onSuccess handler. I think previously you could just call google.script.run.myfunction(), but I think you now must use 
google.script.run.onSuccessHandler(do something with the response in the html file).myfunction()

Not sure if this is your issue.. I know it fixed some of my code.

On Thursday, April 1, 2021 at 5:41:09 AM UTC-4 Andrew Apell wrote:
Guys, are the any back-end changes to Apps Script that would cause google.script.run or modal windows in general to fail?

Faustino Rodriguez

unread,
Apr 1, 2021, 10:53:44 AM4/1/21
to Google Apps Script Community
I am still able to call google.script.run.myfunction() without any handlers for Modeless dialog, haven't tried for Modal
Reply all
Reply to author
Forward
0 new messages