Forms On Submit Trigger

雨燕双飞 提交于 2019-12-23 04:43:29

问题


I've created a simple Google Forms form and am trying to get it to run an Apps Script when the form is submitted. As a simple test to make sure my script is being called, my script simply writes to the log:

function onFormSubmit(e) {
  Logger.log("Testing");
}

I then tried to add the trigger by going "Edit > Current project's triggers". I select the function name in the Run field and "From form" and "On form submit" in the Events fields. I click the Save button and get the error "We're sorry, a server error occurred. Please wait a bit and try again." pop up at the top of the screen.

I've tried this multiple times with different function names, function code (even no code at all in the function, just a comment!), etc but I always get that error. I've also tried doing this from a different Google account and in different browsers (Firefox and Chrome) and get the same error. I tried creating a simple stand-alone script that isn't within a Form, and I was able to set a timed trigger for it and it worked fine.

If I manually run the code then it works fine and the message gets added to the log file, so I assume that the error isn't with my code.

Is there another step that I've missed somewhere? Some sort of authentication or publishing or something?

Maybe it really is a server issue and I just have to wait, so far I've been getting the error for the last 3 hours.


回答1:


I've been getting the exact same behavior for the last couple of days when trying to add a form submit trigger to a script attached to a Google Form. I go to Edit > Current project's triggers, I select the (only) function from the list, I make sure that "From form" and "On form submit" are selected, and then when I click Save, I get the "We're sorry, a server error occurred. Please wait a bit and try again" error.



来源:https://stackoverflow.com/questions/49267236/forms-on-submit-trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!