Summary: Looking for a solution to avoid the automatic disabling of a programmatically created trigger in a form.
function autoTrigger(e) {
var result = {};
var responses = e.response.getItemResponses();
for (var i = 0; i < responses.length; i++) {
var title = responses[i].getItem().getTitle();
var response = responses[i].getResponse();
result[title] = response;
}
var db = FirebaseApp.getDatabaseByUrl("https://firebase-livedata.com");
var form = FormApp.getActiveForm();
db.pushData(form.getTitle(), result)
}
function onSubmitTrigger(e) {
var email = e.response.getRespondentEmail();
var form = FormApp.create("Generated Form " + e.response.getId())
form.addEditor(email)
ScriptApp.newTrigger('autoTrigger')
.forForm(form)
.onFormSubmit()
.create();
}
I have set up a trigger (onSubmitTrigger
) that creates a new form when the original form is submitted. However, the trigger keeps getting disabled automatically (see image attached below). Is there any way to prevent this automatic disabling?
I have already included the necessary library (Firebase), set scopes (
"https://www.googleapis.com/auth/forms"
and "https://www.googleapis.com/auth/forms.currentonly"
), and verified that I am working with the correct form. Can someone provide guidance on how to resolve this issue?