INDIP/CRYFH: having legacy Lotus Script code do your work!

In our company we do have a wonderful, flexible, proven, stable own-built workflow engine, but it is written in Lotus Script code. baah..

I didn’t want to rewrite the whole thing in Java…

But you may now think: hey why does he not run an agent?

I tried, and I failed, how else!!! Always the way I understand things, they will never really work!

Luckily I then I found Kathy Browns article how to do it and it works!!!

Solution:

  • put some value into the NotesDocument to “control” your logic in the LS agent
  • run the agent with the document as parameter
  • write some field in the agent into your document: NO NEED TO SAVE THE DOCUMENT!!!
  • read the result from you NotesDocument in your xPage code and process it
My mistake was: I tried to update a field which was visible on the xPage, and here my approach failed. 
Or could I manually “refresh” the xPage after the agent has run? Seems to be maybe a “timing” issue, cause the value is there, it’s only just not displayed in the field on the xPage. Anyone?

How we use this technique with our workflow engine:
The engine can require a comment to be given for certain target state. But the target state I don’t know yet in the xPage, cause this logic is handled in LS. But with the technique above I can create an agent provide the target action (reject/approve or something else), calculate the target state and find out if for that state a comment is required. If so I can then call a dialog in the xPage where the user can enter his comment. In the agent which runs then, to process the workflow, I then simply read this comment field and process it. In our case it’s written to a workflow log and also included in the notification to the approver of the next state
Nathan: did you read my comment to your comment? I bow to you..

Comments

  1. I hear this "I don't want to rewrite my Lotusscript library in Java" a lot. And I do understand why people say it. But in my experience, it's based on a false premise that doing it is a lot of work. It's really not. Once you get rolling in the Java editor with your Lotusscript in a side-by-side tab, you can get things done REALLY fast.

    And now with the OpenNTF Domino API allowing you to ignore recycles and try/catch blocks everywhere, it should be even faster.

    Maybe I'll put together a demo of this soon.

  2. regarding rewriting: I agree that writing Java code is actually (my humble opinion) faster than writing LS code, but our workflow engine has almost 3000 lines of code, it offers many features.

    Try to find time in the current business to do migrate that!!! Nobody would pay me right now to do this. That will take a few days, and it will require further testing. And by using the tip above (for the time being) i'm settled 🙂

    But I agree Java is the way to go.. from day 1 I was involved in xPages I didn't want to have anything to do with Javascript (or as little as possible)

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.