title: Add an ALERT onEdit - Google Sheets / Google Apps Script
body: <p>The code below triggers when the checkbox gets checked. At that time I would like an alert to popup with a message "Are you sure ?" - BEFORE onEdit runs. So select YES - onEdit runs. Select NO onEdit doesnt run</p>
  
  <p>here is onEdit</p>
  
  <pre><code>function JESSIEToUnassigned(e) {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var s = e.source.getActiveSheet();
    var r = e.source.getActiveRange();
    if (s.getName() == "JESSIE" &amp;&amp; r.getColumn() == 30 &amp;&amp; r.getValue() == true) {
      var row = r.getRow();
      var numColumns = s.getLastColumn();
  
      var targetSS = SpreadsheetApp.openById("");
      s = SpreadsheetApp.getActiveSheet();
      var tempSheet = s.copyTo(targetSS);
      var targetSheet = targetSS.getSheetByName("Current DHL Jobs - UNASSIGNED");
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 5);
  
      // row - whatever row was checked. 5 is 5th Column accross - 1 is 1 row - 3 copy 3 columns from the 
      // 5 th
      tempSheet.getRange(row, 1, 1, 30).copyTo(target);
      s.deleteRow(row)
      AddCheckBoxToA3_D3();
    }
  }
  </code></pre>
  
  <p>and here is the alert</p>
  
  <pre><code>function showAlert() {
    var ui = SpreadsheetApp.getUi(); // Same variations.
    var result = ui.alert(
      'Are you sure you want to continue?',
      ui.ButtonSet.YES_NO);
  
  
    // Process the user's response.
    if (result == ui.Button.YES) {
      // User clicked "Yes".
      JESSIEToUnassigned(e);
    } else {
      // User clicked "No" or X in the title bar.
      ui.alert('Code Stopped.');
    }
  }
  </code></pre>
  
  <p>I have played around with the alert in different parts of the onedit code but I am obviously missing something</p>
  
  <p>Thanks in Advance</p>