title: Prompting an OnEdit dialog to confirm an action
body: <p>I have a good spreadsheets function that will copy paste as values a line of data to another spreadsheet when a user ticks with an X a cell. This worked well. However, I recently added a dialog to confirm the action to prevent inadvertent use. However, for some reason my code is not even executing.</p>
  
  <p>I therefore wonder if there is some faulty logic in my code or if it's a restriction of OnEdit function. Your feedback is of utmost value to me. Thanks.</p>
  
  <pre><code>function CopyPaste(e) {
      var activeSheet = e.source.getActiveSheet();
      var CIP = SpreadsheetApp.openById('12y5scoiksxow09DkW4bXH2YMQLCp_KHBfNFoju3IezA'); //target spreadsheet
      var channels = [49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58]; //Columns to check where the X was ticked
      var ind = channels.indexOf(e.range.columnStart);//Change column numbers to index 
    if (activeSheet.getName() !== 'HL' &amp;&amp; activeSheet.getName() !== 'HA' &amp;&amp; activeSheet.getName() !== 'AU' || ind == -1 || e.value !== 'X') {
  
    function showAlert() {
        var ui = SpreadsheetApp.getUi();
        var result = ui.alert(
       'Please confirm',
       'Are you sure you want to continue?',
        ui.ButtonSet.YES_NO);
      }  
    }
  
  if (result == ui.Button.YES) {
      // User clicked "Yes".
  
      return;
      var target = CIP.getSheetByName('Suggestions'); //Makes the output sheet = t
      var lr = target.getLastRow() &lt; 4 ? 4 : target.getLastRow() + 1; //Should it start on Row 4 or on the last row
      Logger.log(lr); // Log road
      var RequiredData = activeSheet.getRange(e.range.rowStart, 1, 1, activeSheet.getLastColumn())
          .getValues()[0]     
          Logger.log(RequiredData);
          target.getRange(lr, 1, 1, RequiredData.length).setValues([RequiredData])
          Logger.log('done');
      ui.alert('Confirmation received.');
  
    } else {
      ui.alert('Permission denied.');  
    } 
  }
  </code></pre>