I’ve read the tricks on how to run a WQS Agent from xPages, but they all seem to involve using the NotesID after the document is saved. We have an application that uses a form to collect info that we then pass to an agent. The agent formats the data for an http post to a server. We get the response back, do some more formatting, then push the result back to the browser. At no time in the process is the original document saved.
Subject: Re: Agent with Save Options 0 - Server-side Javascript
Yes, I agree that rewrite is the best option, and from what you’re saying it should be a relatively quick change to convert your lotusscript to Server-Side Javascript, set sessionScope variables with the values you want to pass back, and redirect to a page where hose sessionScope variables are used (or use them in the same Xpage).
This may seem a step back, but let’s put this in context. The previous method of creating a form with SaveOptions as 0, triggering an agent on the QuerySave was because the browser does not have access to run server-based code, takes longer to code (especially if you’re doing an AJAX call), takes longer to run and means another agent running on the server. Server-Side Javascript leverages our skills with lotusscript, speeds up coding and speeds up processing. It may mean you have to rewrite your code, but you’re already rewriting your form to be an XPage, so this is a small amount of extra work and will give you useful experience for the future.
“It may mean you have to rewrite your code, but you’re already rewriting your form to be an XPage, so this is a small amount of extra work and will give you useful experience for the future.”
You can’t bet on that.
You’re right that rewriting a form to be an XPage has a slew of benefits out-of-the-box. But if the WQO/WQS agent behind it involves thousands of lines of code across custom LS classes in multiple libraries, then in no way is it a “small amount of extra work.”
For some apps it’s trivial. But for some it’s a massive forklift-style upgrade a la Microsoft, and easily cost-prohibitive. YMMV.
I’m web-enabling a system with tens of thousands of lines of code spread across over 40 LotusScript classes. Rewriting that all in JS is not only prohibitive, but JS would require a complete redesign of the entire system from the ground up, because how Xpages uses JS is not the same as how Agents are employed. I personally would love to do that rewrite, and intended to do it, but I no longer have the time. Deciding to use Xpages at all has put me way behind schedule, so now I must use the existing code. I simply have no choice.
This lack of Agent use without save is yet another in a long string of Xpage debacles that I’m going to have to waste lots of time coding a hack for.
I thought I did my homework before starting, but now I feel like I drank the kool-aid…