This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 27, 2011, 12:25 PM
8 Posts

How to get value from an Agent if i call it on xPage using agent.run()

  • Category: Debugging
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: agent,xpage,run agent
  • Replies: 2
Hi Team,
 
Good Morning/ Afternoon / Evening :-) 
 
here comes a question. 
 
I have a java agent and i am printing some value in that agent using PrintWriter.
In tradtional way if i call that agent through URL or in webquery save of a form it will print those value on the screen. 
 
now here i am calling the same agent on a XPage using agent.run(docid)  method... it executes but i am not getting the print value.
is their any way i get those value.. does Xpage facecontext hold this vlaue? any idea how can i get those print value ?
 
Thanks in advance ... 
 
Aneesh. 
May 27, 2011, 3:41 PM
54 Posts
Re: How to get value from an Agent if i call it on xPage using agent.run()
Here is one solution
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/reuse_lotusscript_xpage.htm
Jun 1, 2011, 8:49 PM
64 Posts
I'd convert legacy agents to AJAX...
- 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...

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal