How can I be getting multiple unwanted event blocks from the same onFormSubmit Trigger?

Solution 1:

Getting spurious onFormSubmit Triggers

As @J.G. pointed out I was getting more that one trigger from each submission of the form.

I noticed by logging the e.values into a spreadsheet that I was not getting any of the answers. So to eliminate these unwanted triggers I just used the following logic.

if(e.values && !e.values[1]){return;} where e.values[1] was a required question.

My log:

enter image description here

The lines with no value in column C are unwanted triggers.

Solution 2:

I think your code proved that some triggers are spurious and unwanted and as such Google should not be generating them. I submitted a feedback item to Google on a similar issue.

In my unwanted triggers, I was only getting the e.range.getRow() to determine which row changed, then going to the row to do the required computation. In my case the row contained correct info for all spurious triggers (probably because the first one correctly recorded the data in the spreadsheet).

Your code is a great backstop to prevent it, but I have way too many forms and triggers to cover. Putting this code in all those places would be a pain. Let's hope google solves this issue soon and we don't see any more spurious triggers occurring.