Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9786

Error on multiple myfunction in onEdit

$
0
0

I am getting an error ReferenceError: options is not defined at myfunctionFDI(OverallScript.gs:39:48)at onEdit(OverallScript.gs:3:1), when I am trying to run multiple myfunctions within onEdit, what am I doing wrong, it appears to run the first myfunction correctly. Help would be appreciated script is here

function onEdit(e) {myfunctionMCR(e);myfunctionFDI(e);}function myfunctionMCR(e) {  var ss = SpreadsheetApp.getActiveSpreadsheet();  var sheet = ss.getActiveSheet();  var sheetName = sheet.getName();  var cell = sheet.getActiveCell().getA1Notation();  var row = sheet.getActiveRange().getRow();  var cellvalue = sheet.getActiveCell().getValue().toString();  var recipients = "joebloggs@blogs.com";  var message = '';  if(cellvalue === 'MCR Approved'){   message = 'Cell '+ cell +' in Sheet MAN '+ sheetName +' was changed to MCR Approved and is ready for your Review & Approval.';  var subject = 'Cell Changed to MCR Approved';  var body = message +'  Visit '+ ss.getUrl() +' to view the change and approve';  var options = {  cc: "fredblogs@blogs.com,bobblogs@blogs.com"  }  MailApp.sendEmail(recipients, subject, body, options);  } } function myfunctionFDI(e) {  var ss = SpreadsheetApp.getActiveSpreadsheet();  var sheet = ss.getActiveSheet();  var sheetName = sheet.getName();  var cell = sheet.getActiveCell().getA1Notation();  var row = sheet.getActiveRange().getRow();  var cellvalue = sheet.getActiveCell().getValue().toString();  var recipients = "fredblogs@blogs.com";  var message = '';  if(cellvalue === 'FDI'){   message = 'Cell '+ cell +' in Sheet MAN '+ sheetName +' was changed to FDI and is ready for your review.';  var subject = 'Cell Changed to FDI Review';  var body = message +'  Visit '+ ss.getUrl() +' FDI to Review';  MailApp.sendEmail(recipients, subject, body, options);  }; }

Viewing all articles
Browse latest Browse all 9786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>