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



Mar 9, 2011, 3:55 PM
16 Posts

Calling LS script library class/function from SSJS

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: ssjs,lotusscript,function,class
  • Replies: 3
I am introducing XPage elements into an existing Notes app 
 
We have existing classes/functions in the app in LotusScript script libraries. Is there any way I can call these classes/functions from my SSJS?

Thanks
 
Mike
Mar 9, 2011, 5:27 PM
149 Posts
Re: Calling LS script library class/function from SSJS
 
This is an interesting question, I hope you get a lot of different answers on this one.
 
the only way I can think of is using an agent to call your functions.
 
My guess is that you want to either return a value or update a document using these scriptlibraries.

both operations can be done using lotusscript agents
The new option in 8.5.2 runwithdocumentcontext is useful for both storing values in a temporary doucument as well as sending a document to act upon.
 
 
Good Luck
Thomas
 
 
 
 
Mar 9, 2011, 11:02 PM
122 Posts
Re: Calling LS script library class/function from SSJS
Like Thomas, my understanding is that it's only possible from an agent. But that will have performance issues and you'll still have to handle errors/responses.
 
As mentioned on The XCast, the GBS Transformer tool has been built with a LotusScript engine, to convert to Java at run-time. But I'm not sure what happens when the code calls UI functions.
 
When approaching these kinds of apps, if the SLs include functions I'm tempted to convert to SSJS or, better still, Java. If it's all back-end processing, it should not be too challenging. Having said that, some functions may be superfluous because we can combine @Formulas, javascript code and even Java inside SSJS. For custom classes I'd be tempted to use Java (even though my knowledge of Java is limited at best) simply because performance is optimal in Java, handling of errors or outcomes is easier, and the experience gained will have supplementary uses. The main challenge is ensuring it is supportable by other developers in my absence.
Mar 10, 2011, 5:47 PM
64 Posts
Re: Call a LS Agent using JSON & return JSON...
- Like Thomas and Paul have already said, an Agent is the simplest recourse.  An option for your Agent is to make it parse and return JSON, then you may call your back-end LS in an ad-hoc fashion from the browser using dojo.  I've done this and it performs considerably better than calling the same OO code using buttons in the Notes Client itself.
 
-  A significant number of developers have LS code that is not ROI viable to convert to Java.  The reason I went the AJAX route is because that was a vastly simpler way to access the legacy LS business logic than to port 30,000 lines of LotusScript to Java, or to use anything SSJS, which was an ordeal I'd have hard time wishing on my worst enemy, in 8.5.1.  I've heard runWithDocumentContext is not the panacea it was rumored to be, so alternatives could be welcome.

- The drawback to the AJAX route is you can NOT call it from SSJS.  It will utterly fail, and may even crash nhttp; I don't recall details about my attempts in that area except it was a Not Good! (tm)  Your mileage may vary.
 
- Fortunately with JSON is also pretty darned simple to roll in exception processing in the wrapper Agent as well.  Doing this is considerably simpler than it sounds at first blush, and I would highly recommend it if you are able to do so.

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