我一直在修改此处找到的帮助台教程脚本:
https://developers.google.com/apps-script/articles/helpdesk_tutorial
由于这仅供内部使用,我删除了“联系电子邮件”字段并将用户名的表单记录设置到电子表格中。我已经编辑了 formSubmitReply 函数补偿:
原来的:
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"});
}
修改的:
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"});
}
如您所见,我所做的只是更改 userEmail 变量的定义方式。当我查看 Live Form 并提交工单时,它似乎有效。
但是,在我将表单嵌入到内部 Google 网站(我们的“内联网”)后,它就不再起作用了。
有没有一种方法可以在嵌入表单时定义 userEmail 才能工作?
我也试过这个:
var userEmail = sheet.getRange(lastRow, getColIndexByName("Username")).getValue();
但没有运气。任何帮助,将不胜感激!我显然是新手,只是试图破解一些东西以使其正常工作。
干杯