1

Is there anyway to call Lotusscript library from server javascript library which return NotesDocumentCollection xpages.

My Old lotusscript library are used in agents and now I am migrating my application to xpages so needed to call these lotusscript for code reuse.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ashish
  • 75
  • 2
  • 9
  • 1
    Please don't do this. I get you likely have a lot of code in LotusScript. Take the time and convert it to SSJS. It's very doable. Give up on LotusScript and embrace XPages. It will be so much better for you in the long run. Please consider it. – David Leedy Jul 11 '16 at 18:59

1 Answers1

4

You can't exchange arbitrary objects directly like that. However, they did add the ability to run an agent with runWithDocumentContext to pass in a designated in-memory Document to use as context, which is a bit more flexible than the older NoteID parameter. You can use that to create a doc in-memory, pass it to the agent, have the agent fill it with info (say, the note IDs of the collection as a multi-value text or RT item), and then read the value back out XPages-side.

Granted, this is more awkward than your immediate desire, but it's the tool we have that doesn't resort to Ajax round-trips.

Jesse Gallagher
  • 4,461
  • 13
  • 11
  • I wanted to show field of documents from Notes Document Collection in excel. the Notes Document Collection is built on basis of few condition. Is there any way to make export to excel working from xpages. – Ashish Jul 11 '16 at 18:58
  • There are several examples out there on creating Excel from Xpages. I think it's on a couple different shows of my NotesIn9 screencast. I forget which but the complete list is available on XPages.TV – David Leedy Jul 11 '16 at 18:59
  • I am able to export to excel from the View Data using serverJavascript library. is there any way to make it work using LotusScript library so I can have code reuse than to write the complete code into Java. One of the example of I am able to complete the code using createWorkbookStream serverJavascript library in Xpages – Ashish Jul 11 '16 at 19:03
  • It's possible to export to Excel via Java or SSJS. SSJS should be thought of as very similar to LotusScript. It is not practical to reuse code between XPages and LotusScript. If you want to learn XPages, you need to embrace it and move to the new code. That's the best thing you can do for yourself in my opinion. Scheduled agents are still a problem though. There isn't a great XPages solution for that. Re-using code between XPages and the Notes Client will cause you nothing but pain and poor performance. – David Leedy Jul 11 '16 at 19:10
  • 1
    Exporting to Excel in the XPages environment has some distinct advantages, allowing you to stream directly to the client. If you want to share code, you could potentially write a Java agent that uses Poi (or maybe LS2J, though I suspect that's pain), as long as you deploy the Jars to the server to avoid the Jar-detachment-leak bug. You could generate Excel files and attach them to temp docs. – Jesse Gallagher Jul 12 '16 at 12:28
  • Taking your LotusScript code and dropping it into an SSJS library would not require a lot of re-factoring. It sounds a lot harder than it is. – David Navarre Jul 12 '16 at 15:15