TypeError: Cannot read property 'columnStart' of undefined at sendMailEdit(Code:2:15)
function sendMailEdit(e){
if (e.range.columnStart != 4 || e.value != "Submitted") return;
const rData = e.source.getActiveSheet().getRange(e.range.rowStart,1,1,15).getValues();
let n = rData[0][1];
let d = new Date(rData[0][0]).toLocaleDateString("en-US");
let linkOfFile = rData[0][12];
let loc = rData[0][1];
let now = new Date().toLocaleString("en-US");
let msg = "Estimate number " + n + " " + "has been submitted. The link for the Project/service file is " + linkOfFile + ". Please update CRM.";
Logger.log(msg);
GmailApp.sendEmail("[email protected],[email protected]", n + " Estimate submitted", msg)
}
function onEdit(e) {
var row = e.range.getRow();
var col = e.range.getColumn();
if
(col === 4 && row > 2){
e.source.getActiveSheet().getRange(row,5).setValue(new Date());
}
}