I have a google form that has the following two fields:
- Email Address: - Text Box
- Tool: - switch
The user enters his email address and selects the tool and presses the "Submit" button. I would like the following message to appear:
Thanks for answering. An email has been sent to you at the indicated email address to download the selected tool.
I have the following code snippet in a script editor
function emailFormSubmission() {
var form = FormApp.getActiveForm();
var dest_id = form.getDestinationId();
var ss = SpreadsheetApp.openById(dest_id);
var theFormSheet = ss.getSheets()[0];
var row = theFormSheet.getLastRow();
var emailid = theFormSheet.getRange(row,2,1,1).getValue();
var tool = theFormSheet.getRange(row,3,1,1).getValue();
form.setConfirmationMessage('Thanks for responding. An email has been sent to you '+ emailid + ' to download' + tool);
}
I also installed triggersto run → emailFormSubmission, → Events Read from Form, onFormSubmit.
: , ( "A" ) "". . ( "B" ) "", . ( "C" ) "", B. , "getlastrow()", FormSubmission.
? ?
UPDATE
@wchiquito, , .
function emailFormSubmission(e) {
var form = FormApp.getActiveForm();
var responses = e.response;
var emailid = responses.getItemResponses()[0].getResponse();
var tool = responses.getItemResponses()[1].getResponse();
Logger.log(emailid);
Logger.log(tool);
form.setConfirmationMessage('Thanks for responding. An email has been sent to '+ emailid + ' with instructions to download ' + tool +'. If you do not find our email in your inbox, please check your spam folder');
Logger.log(form.getConfirmationMessage());
}