title: Xpages- Create New copy of saved document and open it without saving it
body: <p>I have a document that I want to create a new version/copy of, so I am trying to do server-side javascript to</p>
  
  <ul>
  <li>Create a new document</li>
  <li>copy all items from the current document</li>
  <li>open the new document that I have created, without saving it</li>
  </ul>
  
  <p>I am not able to open the newly created document, is this possible?</p>
  
  <p>code I am using is:</p>
  
  <pre><code>var viewPanel=getComponent("viewPanel1");get the componet of viewPanel
  var docIDArray=viewPanel.getSelectedIds(); get the array of document ids
  for(i=0;i &lt; docIDArray.length; i++){
      var docId=docIDArray[i];
      var doc=database.getDocumentByID(docId);
      var newDoc = database.CreateDocument
      doc.CopyAllItems (newDoc)
      var docUNID = newDoc.getUniversalID ()
      // need something here to open copied document
  }
  </code></pre>