Commit 8d577cd9 authored by Jeremy Pallats's avatar Jeremy Pallats 💬
Browse files

Update the onChange example in the web portion.

parent d01a719d
Loading
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
function umChange(e) {
// Set this in the trigger management of an excel sheet.
// Use the onChange trigger and assign this function to handle the event.
// Update the 'scanner' line below depending on what scanner should schedule.
function onChange(e) {
  // REQUIRED!!!! Force Google permission for active user, comes in event
  Session.getActiveUser()
  msg = {
    'spreadsheet': e.source.getName(),
    'sheet': e.source.getActiveSheet().getName(),
    'scanner': 'hudson_um',
    //'spreadsheet': e.source.getName(),
    //'sheet': e.source.getActiveSheet().getName(),
    'time': new Date(),
    'scanner': 'hudson_um',  // Change this to name of scanner in config
  };

  // Make a POST the json to server
  var options = {
    'method' : 'post',
    'contentType': 'application/json',
@@ -15,10 +19,15 @@ function umChange(e) {
    'validateHttpsCertificates': false
  };

  if (e.user.nickname != 'gearbot3003') {
  try {
    email = Session.getActiveUser().getEmail()
  } catch (err) {
    email = ""
  }

  // Ignore all changes by the actual bot account
  if (email.search("federalelitebot@cogent") === -1) {
    UrlFetchApp.fetch('starcraftman.com/post', options);
  }

  // Debug Only
  //e.range.setNote(JSON.stringify(msg));
}