I have a google form that asks up to 40 questions with a script firing on the "On form submit" event.
Most of the time I successfully reference the currently submitted response to var formResponse via this code which gets an array of all of the responses and then the most current via .length-1:
var formResponses = form.getResponses();
var i = formResponses.length-1;
var formResponse = formResponses[i];
It seems that when the form collects 25+ responses there is a processing delay and the script will run but the response has somehow not yet been added to the .getResponeses() array. The result is that the script runs again for an older response. By the time I go to look at the form and the spreadsheet containing the results it has been updated as expected but the event has already fired on the incorrect response...so I am wondering if I am referencing correctly or if there is an issue on the google form side. The issue is alleviated temporarily when I Delete all responses from the form but comes up again once the number of responses has reached approximately 25.
Thanks for your support!