I have been modifying the Help Desk tutorial script found here:
https://developers.google.com/apps-script/articles/helpdesk_tutorial
Since this is for internal use only, I removed the "Contact Email" field and set the form log the Username to the spreadsheet. I've edited the formSubmitReply function compensate:
Original:
function formSubmitReply(e) {
var userEmail = e.values[3];
MailApp.sendEmail(userEmail,
"Help Desk Ticket",
"Thanks for submitting your issue. \n\nWe'll start " +
"working on it as soon as possible. \n\nHelp Desk",
{name:"Help Desk"});
}
Modified:
function formSubmitReply(e) {
var userEmail = e.user;
MailApp.sendEmail(userEmail,
"Help Desk Ticket",
"Thanks for submitting your issue. \n\nWe'll start " +
"working on it as soon as possible. \n\nHelp Desk",
{name:"Help Desk"});
}
As you can see, all I've done is change how the userEmail variable is defined. When I view the Live Form and submit a ticket, it seems to work.
However, after I embedded the form into an internal Google site (our "intranet"), it no longer works.
Is there a way that I need to define userEmail to work when the form is embedded?
I also tried this:
var userEmail = sheet.getRange(lastRow, getColIndexByName("Username")).getValue();
But had no luck. Any help would be appreciated! I'm obviously new at this and just trying to hack a few things to get it working properly.
Cheers