Tuesday, March 13, 2012

How to pass the Document context in Xpages while calling an Agent?

var agent=database.getAgent("javaSwing");
document1.save();
agent.runWithDocumentContext(currentDocument.getDocument())

The above will call the agent and we can get the current document's item value in java agent context. Condition is, we should save the document before we pass the document.

If we use the following code is used to pass the current document, And also we can get the item value of the current document without saving it.

var agent=database.getAgent("javaSwing");
agent.runWithDocumentContext(currentDocument.getDocument(true))

No comments:

Post a Comment