It's all in the timing

  • I’ve had nothing but problems using Agents in XPage data source events. So I ditched that approach.

  • Now I set a sessionScope variable to indicate what I want done as a “webquerysave”, and and each page checks the sessionScope variable. If it’s populated it does what it says, then deletes it. The work is done using AJAXy calls via an XSP.addOnLoad(). It’s ugly, but unlike data source events, it works reliably. Bonus.

  • It won’t work if someone simply closes the browser, but that doesn’t seem like unexpected behaviour, really.

  • The last fly in the ointment is that because it’s running on page load, in the client, I don’t know how to trigger a partial refresh. There are elements on some of the pages that contain information updated by this “webquerysave” hack, and those elements aren’t reflected on the loading page because they’re changed after rendering.

  • I guess I could try running the Agent in beforePageLoad or something. I’m just done with Xpage events and Agents if I can avoid it. Running Agents in AJAXy fashion from the client works beautifully.

  • Sadly my AJAXy functions use dojo, which isn’t loaded server-side, so I haven’t tried the server “calling” itself using AJAX. I may yet go there if that seem the best approach, but I’d have to “code it by hand”. Or will dojo work server-side? Dojo is pretty spiff.

  • Is there some way to make do a partial (or even total) refresh from the client? Or do this call some other way?

Thanks for your time…