title: How to pass the Document context in Xpages while calling an Agent?
body: <p>How to pass the Document context in Xpages while calling an Agent? In Xpage, I am in need of calling a java agent with documentcontext from my Xpage, And also I am in need of passing my current document as a parameter...</p>
  
  <p>In Lotuscript we can do it as easily without saving the current document, but in Xpage I am using the following code., document1 is a current document.</p>
  
  <pre><code>var agent=database.getAgent("AgentName");
  agent.runWithDocumentContext(currentDocument.getDocument());
  </code></pre>
  
  <p>This code I am not able to get the values of my current document's items, but if I will use the following code,</p>
  
  <pre><code>var agent=database.getAgent("AgentName");
  document1.save();
  agent.runWithDocumentContext(currentDocument.getDocument());
  </code></pre>
  
  <p>I can get the item value of the current document... But I do not want to save the document, without saving the document I need to get the item value of item.</p>
  
  <p>Please give any nice solution for that...</p>