I have this very simple code below that I need to run when a google form associated to it has been submitted. I tried to fill-in the form and after submitting it, I checked my executions on google app script and it says "e.response is not a function."
Also, when I debugged it on App Script, it says
Cannot read property 'response' of undefined at onFormSubmit(Code:2:24)
hich I think is because it cannot retrieve any data since the form wasn't filled-in.
function onFormSubmit(e){
var formResponse = e.response;
var itemResponses = formResponse.getItemResponses();
var email = itemResponses[0].getResponse();
var firstName = itemResponses[1].getResponse();
MailApp.sendEmail(email, firstName+", we have received your application", "Hello, "+firstName);
}
Any suggestions to fix this? I need the script to run upon form submission to send like a confirmation message.