我想使用觸發器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此腳本僅適用於 –