Status Update
Comments
se...@google.com <se...@google.com>
se...@google.com <se...@google.com> #2
Hello,
Thank you for filing this issue!
Can you provide the add-on manifest file, the full add-on code (in case there is more) and the detailed steps you use to create it and run it?
Thank you!
vf...@usuhs.edu <vf...@usuhs.edu> #3
Thank you for addressing this bug report.
The manifest file looks like this:
{
"timeZone": "America/New_York",
"dependencies": {
"libraries": [{
"userSymbol": "MU",
"libraryId": "[Unrelated Library Script ID]",
"version": "1",
"developmentMode": true
}]
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
Unfortunately it is unfeasible to share the full add-on code unless I were to share the project with you.
createTrigger()
is called from custom HtmlService content using google.script.run
.
vf...@usuhs.edu <vf...@usuhs.edu> #4
Furthermore, I know that the trigger is being created because I can see it listed among my triggers at
vf...@usuhs.edu <vf...@usuhs.edu> #5
Because this is such an app-killer for me, I developed a separate Apps Script Project to test this issue. The trigger is created without issue but never fires, just like my other add-on.
The entire code is as follows:
function onOpen() {
FormApp.getUi().createAddonMenu().addItem('Test', 'test').addToUi();
}
function test() {
ScriptApp.getProjectTriggers().forEach(trigger => {ScriptApp.deleteTrigger(trigger)}); // Alternatively ScriptApp.getUserTriggers(FormApp.getActiveForm())...
ScriptApp.newTrigger('other').forForm(FormApp.getActiveForm()).onFormSubmit().create();
}
function other(e) {
console.log('Form Response received:' + e.response.getItemResponses().map( itemResponse => '\n' + itemResponse.getItem().getTitle() + ': ' + itemResponse.getResponse()).join());
}
From the Run > Test as add-on... menu:
- Version - Test with latest code
- Installation config - installed and enabled
- (Tested with both locally owned Forms and Forms in shared drives)
se...@google.com <se...@google.com> #6
Hi,
Apologies for the delay!
Have you considered using onInstall()
instead of onOpen()
to run the trigger creation?
As mentioned in the
- The open event for Google Forms does not occur when a user opens a form to respond, but rather when an editor opens the form to modify it.
Regards.
vf...@usuhs.edu <vf...@usuhs.edu> #7
Thank you for your response.
I think you misunderstand. In the example I provided, the simple onOpen()
trigger creates an add-on menu which is where a user calls the trigger-creator function test()
. I am able to call test()
and create the trigger as expected.
The problem is that installed onFormSubmit triggers are not firing as they should and does not have to do with simple triggers.
se...@google.com <se...@google.com> #8
Hello,
Have you tried if setting the script to DEPRECATED_ES5
instead of V8
runtime environment?
se...@google.com <se...@google.com> #9
Hello,
Have you tried if setting the script to DEPRECATED_ES5 instead of V8 runtime environment makes any difference?
vf...@usuhs.edu <vf...@usuhs.edu> #11
Reverting to the ES5 runtime does not work either. I can't even load a dry-run document correctly. The simple onOpen()
trigger fails, and in the execution transcript the error reads
Syntax error.
at [unknown function](Utilites:170)
I don't have a Utilities.gs file, so I'm left to guess that some anonymous internal apps script function is causing the error.
My code:
function onOpen(e) {
FormApp.getUi().createAddonMenu()
.addItem('Setup', 'setup').addSeparator()
.addItem('Instructions', 'help').addSeparator()
.addItem('Test', 'test').addToUi();
}
vf...@usuhs.edu <vf...@usuhs.edu> #12
Correction regarding the previous comment: A library included in the add-on was not reverted back to ES5, and while not called directly with the onOpen
trigger, still contained syntax not supported in ES5, and threw a syntax error.
vf...@usuhs.edu <vf...@usuhs.edu> #13
To clarify with hindsight into this issue: you cannot install onFormSubmit triggers while testing add-ons. This was made clear while testing with the ES5 engine, which threw an error when I tried to run the trigger-creator function in a test run. The source of my confusion was that there was no error shown using V8 since the trigger was created but didn't fire.
The relevant documentation:
Description
I am developing an internal Google Forms add-on that requires the use of an installable onFormSubmit trigger.
The trigger is created like so:
Submitting form responses does not cause
otherFunction
to run. No executions are listed when I view this trigger's executions.My environment:
Please let me know if I can provide further information to assist in the resolution of this bug.