mardi 29 juin 2021

Need to send an email to Form respondents based on question answer

I need some help! I am trying to automate sending an email to the form respondent if they select any of the AcLab Session Full answers. The possible answers range from blank up to AcLab Session Full19

I successfully got it to send an email on every response, only problem is I need it to send only when the respondent selects a particular thing, and not everything.

Now I've messed up the code and it isn't working at all!

Here is where I think I've messed up (keep in mind, I'm not a developer or coder, this is pieced together from many different places and is likely incorrect)

function AutoConfirmation(e)
{
      var theirFirst = e.values[2];
      var theirEmail = e.values[1];
      var theirSession= e.values[4];
      var subject = "Action Required: Your Selected AcLab Session is Full";
      var message = "Thank you " + theirFirst + ",<br> <br> The AcLab session that you have selected for this week is full. " 
      var cosmetics = {htmlBody: message};
      
 if (SpreadsheetApp.getActive().getSheetByName('Form Responses 1').getRange('Form Responses 1!E2:E10000').getValue(theirSession)=""||"AcLab Session Full1"||"AcLab Session Full2"||"AcLab Session Full3"||"AcLab Session Full4"||"AcLab Session Full5"||"AcLab Session Full6"||"AcLab Session Full7") return;
MailApp.sendEmail (theirEmail, subject, message, cosmetics);}

Aucun commentaire:

Enregistrer un commentaire