title: SSJS global variable seems not working
body: <p>I had declared and used a global variable in ssjs library as below:</p>
  
  <pre><code>var backendDoc:NotesDocument = null;
  
  function savedata () {
    print (backendDoc.getItemValueString("fieldname"));   // crash here  
  }
  </code></pre>
  
  <p>I assigned a document object to it in the Edit button just after changing docuemnt mode from read to edit:</p>
  
  <p>backendDoc = document1.getDocument();   // get backend document from datasource called document1</p>
  
  <p>The code in above function return error NotesDocument.getItemValueString("string")) null.  Apparently, the backendDoc is null. </p>
  
  <p>Any ideas how to assign value and use global variable in ssjs library?  Thanks in advance</p>