If you are using Google Help Desk form as a template (I've adapted it and had it working well) the following code stolen from the expense report tutorial to automate an email to a help desk google group.
// Main tutorial function:
// For each row (expense report):
// - if it's new, email the report to a manager for approval
// - if it has recently been accepted or denied by a manager, email the results to the employee
// - otherwise (expense reports that have already been fully processed or old expense reports
// that still have not been approved or rejected), do nothing
// Ideally, this function would be run every time the Approvals Spreadsheet or the Expense Report
// Spreadsheet are updated (via a Form submission) or regularly (once a day).
function onRequestSubmit() {
// This is the Sets Spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Fetch all the data from the Spreadsheet
// getRowsData was reused from Reading Spreadsheet Data using JavaScript Objects tutorial
var data = getRowsData(sheet);
// For every request
for (var i = 0; i < data.length; ++i) {
var row = data[i];
row.rowNumber = i + 2;
if (!row.notification) {
// This is a new Expense Report.
// Email the manager to request his approval.
sendReportToManager(row);
// Update the state of the report to avoid email sending multiple emails
// to managers about the same report.
sheet.getRange(row.rowNumber, COLUMN_STATUS).setValue(row.notification);
}
}
}
// Sends an email to a manager to request his approval of an employee expense report.
function sendReportToManager(row) {
var message = "<HTML><BODY>"
+ "<P>" + row.username + " submitted a Tech Request."
+ "<P>" + "<HR>"
+ "<P>" + "Name: " +
row.name + "<P>" + "Date Submitted: " + row.timestamp
+ "<P>" + "Building: " + (row.building || "")
+ "<P>" + "Room #: " + (row.room || "")
+ "<P>" + "<HR>"
+ "<P>" + "Computer ID Information: " + (row.computerIdInformation || "")
+ "<P>" + "Description: " + row.description
+ "<P>" + "Urgency: " + row.urgency
+ "<P>" + "<HR>"
+ '<P>Click to access helpdesk spreadsheet <A HREF="' + HELPDESK_URL + '">here</A>.'
+ "<P>" + '<img src="
https://sites.google.com/a/scfschools.com/staff-resources/_/rsrc/1317585072365/home/saints-logo/saintsimages.jpg"/>' + "</HTML></BODY>";
MailApp.sendEmail("
xxxxx...@domain.com", "Tech Request - " + row.building +" / "+
row.name, "", {htmlBody: message}); row.notification = STATE_MANAGER_EMAIL
}
If you want I can share a copy of the complete form if interested. It is nothing earth shattering, just works....
Have a great weekend,
bk