jeudi 26 mars 2020

Simple Edit check to email out person not working

am hope you can help me here. I am trying to do a simple thing. When someone puts a Y in a cell on sheet it emails someone.

But the strange thing i am getting it no matter what i put for the check Y F T bob it ALWAYS email out regardless of the value. Its like the IF is just setting whatever i am asking it to check to the value and doing it. Never seen this in the years of programming so have a look at this code and see if any of you can see something i am missing. I am using a edit trigger

function sendEmailsRec() {

var EMAIL_SENT = 'EMAIL_SENT';

var QAemailAddress = "X" ;

var POs = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(11, 2).getValue(); var message = "Ready for receiving for PO " + POs;

// This value is the check value but even when NOT Y the IF triggers. In fact when i print this value // It gets the value in cell then CHANGES it to Y and triggers without any input entered.

var QAcheckbox = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(37,5).getValue();
var subject = "Ready for receiving for PO" + POs;

if(QAcheckbox ="Y",MailApp.sendEmail(QAemailAddress, subject, message));// Always triggers regradless of value if(QAcheckbox ="Y",SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(63, 3).setValue(EMAIL_SENT));

}**

So any help would be great.

Aucun commentaire:

Enregistrer un commentaire