How to change/set DocumentContext of an agent

Hello,

I have a webQuerySave agent (agent1). The agent needs to call/run another agent (agent2). agent2 needs to act/read on the DocumentContext (same document) of agent1 (before document is saved so that I can get the new field values).

If I use the ParameterDocuementId I get a new copy of the saved document in the database on agent2.

Any idea how to change/set the DocumentContext of agent2 to be the same like agent1?

from the help of the DocumentContext:

“…Through the C or C++ API, an external program can create an in-memory document, then run an agent. The agent can use this property to access the in-memory document…”

Anyone with an example?

Thanks

Subject: How to change/set DocumentContext of an agent

Is there a reason why agent 1 needs to call another agent? Can you not simply invoke a separate routine – either in your agent or in a script library it references? That way, the separate routine could take a NotesDocument as an argument, and so in your agent code you simply do something like this:

[…]

Set doc = session.DocumentContext

’ // Do stuff to doc in your agent then

’ // invoke routine in library

Call doAnotherRoutine(doc)

[…]