Я пытаюсь добавить это в свой сценарий, поэтому, когда ответ будет« областью T/L », тогда область T/L будет равна« имени »(скажем, Джек, например,»я использую этот скрипт теперь отлично работает просто хотел, чтобы иметь возможность редактировать ответ перед отправкой таблицыЕсли ответ равен значению, тогда значение равно «
вот что у меня есть
response = itemResponse.getResponse().toString(); // get the corresponding answer
if (typeof response === 'undefined') response = '';
полный скрипт
function onSubmit(e) {
var myemail = "[email protected]" // please, replace myemail by your email
try{
var formResponse = e.response;//get the form response
var editResponseUrl = formResponse.getEditResponseUrl(); //get the individual form url just in case the respondent needs to edit its anwers later
var itemResponses = formResponse.getItemResponses();// get all item questions and anwers
var itemResponse
var title
var response
for (var i = 0; i < itemResponses.length; i++) { // iterate for all form items
itemResponse = itemResponses[i];
title = itemResponse.getItem().getTitle().toUpperCase(); // get the question title. In our form can be EMAIL or NAME
response = itemResponse.getResponse().toString(); // get the corresponding answer
if (typeof response === 'undefined') response = '';
if(title.indexOf("AUDITOR", 0) != -1){ // if the title is "AUDITOR NAME"
var auditor = response.toUpperCase(); // get it
}
else if (title.indexOf("JCI", 0) != -1){ // if the title is "STATION NAME"
var work = response.toUpperCase(); // get it
}
else if (title.indexOf("RELATED", 0) != -1){ // if the title is "ISSUES FOUND"
var found = response.toUpperCase(); // get it
}
else if (title.indexOf("DEPARTMENT", 0) != -1){ // if the title is "DEPARTMENT RESPONSIBLE"
var department = response.toUpperCase(); // get it
}
else if (title.indexOf("RESULTS", 0) != -1){ // if the title is "NAME"
var results = response.toUpperCase(); // get it
}
}
var subject = results + ",\n\n"; // body of the message you're assembling
subject += "Process Confirmation Audit, \n\n"; // body of the message you're assembling
subject += department + ",\n\n"; // body of the message you're assembling
var message = auditor + ",\n\n"; // body of the message you're assembling
message += "Just Completed Station Audit \n\n"; // body of the message you're assembling
message += work + ",\n\n"; // body of the message you're assembling
message += "FAILED AUDIT ISSUES FOUND:\n\n"; // body of the message you're assembling
message += found + ",\n\n"; // body of the message you're assembling
message += "Please Assign Ownership For This Issue:\n\n"; // body of the message you're assembling
message += "Click On The Link Below To Review/Assign Ownership Responsibilites:\n\n"; // body of the message you're assembling
message += editResponseUrl + "\n\n"; // body of the message you're assembling
MailApp.sendEmail("[email protected]", subject, message); // send the message
}
catch(e) { // if something wrong happens
MailApp.sendEmail(myemail, "Error in Auto replying to contact form submission.", e.message); // tell me
}
}
Попробованных, чтобы помочь вам с моим aswear, если не ясно, предоставить более подробную информацию о значении переменных itemResponse и результате вызова GetResponse(). Best, Br Araujo –