title: Pass a variable between a script bound to a Google Form and a script bound to its destination sheet
body: <p>I am having issues getting information from a Google Form into a Google Sheet. I am looking to get the edit url <code>onFormSubmit</code> and then set it to the end of the record in a column where the responses are stored.</p>
  
  <p>Research:</p>
  
  <ul>
  <li>I asked <a href="https://stackoverflow.com/questions/36606919/cannot-call-method-geteditresponseurl-of-undefined-on-google-apps-script-bound">this question</a>, which started as a script bound to the sheet but trying to access the form. It then became a script bound to the form, trying to access the sheet.  </li>
  <li>I found <a href="https://stackoverflow.com/questions/28143036/how-can-an-apps-script-on-a-form-store-extra-data-into-the-sheet">this question</a> which looks to be related to my question (with a slightly different use case). Similarly to mine, I think it will have issues getting spreadsheet methods while on the form. </li>
  </ul>
  
  <p>Since both required methods that are only available to either the script or the form I keep hitting a wall. Now I am thinking that I may need a hybrid solution that requires some of the code to be bound to the sheet, and some to be bound to the form, with a variable passed between the two scripts that are both executing <code>onFormSubmit</code>.</p>
  
  <p>This is what I think I should keep bound to the form</p>
  
  <pre><code>    function onFormSubmit(e)
      {
        Logger.clear; //if I can use log to pass variable I want to clear out at the beginning of each submission 
  
        var form = FormApp.getActiveForm();
        var activeFormUrl = form.getEditUrl();//This is the variable I need to pass to the sheet
  
        Logger.log(activeFormUrl); //only to confirm what we are getting unless I can somehow access the log after the fact using sheet script
  
      }//This is the end of onFormSubmit function bound to the Form
  </code></pre>
  
  <p>This is what I think I should keep bound to the sheet</p>
  
  <pre><code>function onFormSubmit(e)
  {
    var ss = SpreadsheetApp.getActiveSheet();
    var createDateColumn = ss.getMaxColumns(); //CreateDateColumn is currently in AX (Column 50) which is the last/max column position
    var urlColumn = createDateColumn-1; //urlColumn is currently in AX (Column 50) Calculating using it's relative position to createDateColumn Position
  
    if (ss.getActiveRange(urlColumn).getValue() == "") // so that subsequent edits to Google Form don't overwrite editResponseURL
    {
       var editResponseURL = setGoogleFormEditUrl(ss, createDateColumn, activeFormUrl);
       var createEditResponseUrl = ss.getActiveRange(urlColumn);
       createEditResponseUrl.setValue(activeFormUrl);  
    }
    else
    {
       if (ss.getActiveRange(urlColumn).getValue() != activeFormUrl)
       { 
           Logger.log("Something went wrong - URL doesn't match" + activeFormUrl);
           Logger.log(ss.getActiveRange(urlColumn).getValue());
           var checkLog2 = Logger.getLog();
       }
       else {}//do nothing
     }   
  }//This is the end of the onFormSubmit function bound to the Sheet
  </code></pre>
  
  <p>What I need to know is how to take <code>activeFormUrl</code> from the form script and send it to the sheet script. Can I use the log?</p>