title: How can I build script with an onEdit Trigger for a specific range, insert note in the cell, with timestamp?
body: <p>I'm a beginner at coding so any advice or guidance would be entirely helpful. I'm working on a script that uses onEdit () for a specific range/column.</p>
  
  <p>Once the onEdit () triggers with an if statement I'm assuming, a customized dialog prompt will appear to insert a note. After you type the note, it will tag the data validation you selected and insert it as a note on the cell with a timestamp.</p>
  
  <p>Here's a sample sheet I made for this question:
  <a href="https://docs.google.com/spreadsheets/d/12-b4pUK5xKqlLlOKvPxd-UZ__RaJMiEWXHPH5K9GvU4/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/12-b4pUK5xKqlLlOKvPxd-UZ__RaJMiEWXHPH5K9GvU4/edit?usp=sharing</a></p>
  
  <p>Please feel free to ask questions!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> 
    
    function onEdit() {
      var ss = SpreadsheetApp.getActiveSheet().getActiveRange();
      var select = ss.getDisplayValue();
         if (select = 'Phone'){
      var ui = SpreadsheetApp.getUi(); 
      var name = Session.getActiveUser();        
      var cell = ss.getDisplayValue()
      var timestamp = Utilities.formatDate(new Date(), "EST", "MMM dd");
      var pnote = ss.getNote()
      Logger.log(timestamp);
      var result = ui.prompt(
        'Would you like to add a short note?',
        '',
        ui.ButtonSet.OK_CANCEL);
      
      // Process the user's response.
      var button = result.getSelectedButton();
      var text = result.getResponseText();
      var notes = [
        [pnote],
        [timestamp +": "+name + ": "+cell +": "+text+'.']
      ];
      if (button == ui.Button.OK) {
        // User clicked "OK".
        ss.setNote(notes);
      } else if (button == ui.Button.CANCEL) {
        // User clicked "Cancel".
        ui.alert('You did not set a note.');
      } else if (button == ui.Button.CLOSE) {
        // User clicked X in the title bar.
        ui.alert('You closed the dialog.');
      }
           
      }     else {
          Logger.log("Cell was out of range");
      }
    }
  
  //Attempt 2 (no luck) would replace the first portion of script up to if statement.
  //    var ss = SpreadsheetApp.getActiveSheet().getActiveRange();
  //    var column = ss.getColumn();
  //    var actionColumn = [3]
  //    
  //    if (actionColumn.indexOf(column) = 3){</code></pre>
  </div>
  </div>
  </p>
  
  <p>My question is how can I get this script to be triggered only when a data validation is selected in a specific column. Maybe the next work in could be having multiple if statements to customize the dialog questions &amp; notes.</p>
  
  <p>Thank you in advance!</p>