- It's simply a PITA to try to use any document-based approach. Even the link provided one has to go through a ton of shenanigans to make the profile document work, and my experience is profile documents are not a reliable long-term solution. I've seen them randomly fail literally for decades. My experience with non-profile parameter documents is the Agent's copy of the document and the XPage's copy of the document fail to sync up correctly. I'm sure the new context capability helps.
- But really. Simplest is to avoid that whole can of worms. AJAX takes a bunch of strings in and spits a bunch of strings out. It can't be any simpler and therefore less prone to failure.
- Write a wrapper class that manages the AJAX input and output, then stick that in your Agent at the start to parse data, and the end to spit data out. It's even pretty simple to detect when the Agent is getting AJAX or something else and bypass AJAX processing if it's not needed, so the same Agent falls back to working exactly like it always has. Using Java you probably don't even have to write the wrapper class ... I did all this in LotusScript. It sounds harder than it is.
- Just remember: AJAX works with strings. Nothing but strings. The rest is merely formatting.
- Drawback to AJAX is it must be called from the browser, you can't call an AJAX-ified Agent from SSJS, like you are doing for agent.run(). You also have to dabble in dojo a little, but not much. Calling AJAX in dojo is about as simple as it gets. There's a cornucopia of examples in the R8.5 Notes.net forum.
Hope this helps...