form trigger not working?

257 views
Skip to first unread message

james cui

unread,
Jun 6, 2021, 11:19:44 PM6/6/21
to google-apps-sc...@googlegroups.com
Hey,

    I spent some time playing with form based triggers, but had a bad experience. 
Here is simplified code
function onGetFormResponse(event) {
  console.log('onGetFormResponse:' + event);
}

function test() {
         ScriptApp.newTrigger('onGetFormResponse')
        .forForm(FormApp.getActiveForm())
        .onFormSubmit()
        .create();


The test() function is driven by UI action and is called once a button is clicked. 
I can see the trigger is created, but was disabled with the warning "form trigger this trigger has been disabled for an unknown reason". I then manually save the trigger again, the warning disappears. However, when I submit the form response, the function onGetFormResponse() is not called at all. Wonder to know what was wrong?


Alan Wells

unread,
Jun 7, 2021, 8:41:37 AM6/7/21
to Google Apps Script Community
I'm not sure if what you are describing is related to the issue at the following link:

People have been reporting new issues related to triggers, which seem to have increased since the new code editor rolled out.
Triggers should be one of the highest priorities for Apps Script.  If your code doesn't run, then it doesn't matter how good your code is.
Apps Script is totally useless if the code doesn't run and doesn't run reliably.

james cui

unread,
Jun 9, 2021, 8:12:25 PM6/9/21
to google-apps-sc...@googlegroups.com
It seems that was the bug and when I checked out today, the trigger created is not disabled by default. 
However, the trigger only works for a bound script (bound to a form).
The trigger function still does not work in a standalone script
Did anyone encounter the same problem? 
It said the authMode is required to be FULL, what does that mean?
Using testing as an addon, it seems I couldn't get FULL permission, but only NONE or LIMITED. 

--
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/f4d2977a-91ee-4005-a93d-8e8b6d82182cn%40googlegroups.com.

Alan Wells

unread,
Jun 9, 2021, 9:15:58 PM6/9/21
to Google Apps Script Community
You can't create installable triggers when testing as addon.  
Quote:
  • Installable triggers aren't supported when testing. Functionality that depends on installable triggers are not testable.
Unquote

See:

I never use the "testing as addon" option.  I use a bound script project to develop and test the addon.  

Reply all
Reply to author
Forward
0 new messages