0

Initial situation: I am trying to send an automated Mail to the supervisor, when someone of his team submitted a holiday application, so the supervisor is able to approve it.

The application is submitted via a form and the form answers are moved to a spreadsheet. The form answers contain: email address & Team. There are three teams, each with one supervisor.

The plan is to send a mail with an automated text like: "One of your team members submitted a holiday application"

The mail should be send the moment the form answer is moved to the spreadsheet.

1 Answers1

0

Try something like this:

//You create a form submit trigger
function myFunction(e) {
  var recipient=e.namedValues('email address');
  var subject="Holiday Application"
  var body=Utilities.formatString('One of your team members in %s submitted a holiday application.',e.namedValues('Team')); 
  GmailApp.sendEmail(recipient, subject, body);
}

If you have problems with multiple trigger see this question.

Cooper
  • 59,616
  • 6
  • 23
  • 54