XPages + WQS agent?

If an XPage is updating a document (or multiple documents), I know that you can enable ComputeWithForm.

Do/can the form’s WebQueryOpen and/or WebQuerySave agents fire as well?

Subject: XPages and agents

Those agents are not fired directly as they are tied to the web server processingWithin Xpages, you can call an agent from the ‘postSaveDocumentEvent’, by just using the standard Java/Javascript API

Subject: Wiki this?

Here’s my thinking…

Legacy LotusScript-based web apps rely heavily on forms with WQO/WQS agents that process docs as they are opened/saved.

Based on what you said, you should be able to take such an existing app and migrate it to XPages to gain many of the UI and frontend benefits very rapidly, while still leaving the bulk of the backend in LS. Then you could migrate the backend code to Java for better XPage integration later.

E.g. say you’ve got a WQS agent called MyAgent that is written LotusScript. It grabs NotesSession.DocumentContext and does stuff with the doc.

It sounds like you should be able to:

  1. Modify MyAgent to no longer use NotesSession.DocumentContext but instead use NotesAgent.ParameterDocID.

  2. Build an XPage.

  3. In the postSaveDocumentEvent on the XPage you issue an Agent.Run() call to MyAgent, passing in the target doc by calling Agent.Run(targetDocNoteID).

Would the XPage pause execution until the called agent had finished?

If this is all doable I think it’s a great idea for a Wiki example

.

Subject: Exactly…

Hi Erik,

yes, you’re right on. The agent would need to open the (saved on disk) note via

notesDatabase.GetDocumentByID( NotesAgent.ParameterDocID )

It might require a bit more code changes in the agent though because WQS agents usually operate on the in-memory note (accessed via the .NotesDocumentContext) rather than a note already saved on disk.

Also, here’s a related wiki article I just posted recently on how to get the noteID/UNID of an xpage datasource document to be able to then call such an agent:

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/xpages-get-unid-of-created-xpage.htm

Feel free to write this all up asa new wiki post… everyone can contribute!

thanks

Thomas

Thomas Gumz - Advisory Software Engineer - IBM Lotus Software


“A clean desk is a sign of a cluttered desk drawer.”