我想使用触发器onFormResponse使功能运行。但是,当我使用现场表单进行测试时,没有任何反应。我尝试删除,重新创建触发器和脚本,但它仍然无法正常工作。感谢您的帮助!谷歌脚本触发表单提交不工作
function onSubmit(e) {
//function get ID of the submitted response, log it to the console
//run a afunction that ask for permission to get a refilled URL
//based on the submitted one
//email the log to me
//get current form
var currentForm = FormApp.getActiveForm();
// Get ID of form on submited
var ID = e.response.getId();
Logger.log(ID);
checkPermission(currentResponse);
var recipient = Session.getActiveUser().getEmail();
var subject = 'Log';
var body = Logger.getLog();
MailApp.sendEmail(recipient, subject, body);
Logger.clear();
}
function checkPermission(e){
var ui = FormApp.getUi();
var dialogBox = ui.alert('Do you want to create a prefill form?',
FormApp.getUi().ButtonSet.YES_NO);
if(dialogBox == ui.Botton.YES){
var link = ui.alert(e.toPrefilledUrl());
}
}
function triggerTester(){
// create a an on form submit trigger for function onSubmit
var currentForm = FormApp.getActiveForm();
ScriptApp.newTrigger('onSubmit')
.forForm(currentForm)
.onFormSubmit().create();
}
你应该做的第一件事是查看执行文件。在日志打印输出的底部,应该有关于脚本是否完成的声明,如果不是,则说明错误发生在哪一行。 –
这是表单中或接收电子表格中的脚本? –
@Karl_S此脚本仅适用于 –