Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run server side javascript in an agent

is there a way to run server side javascript periodically in lotus notes?

I try to create an java agent with this simple script

      ScriptEngineManager manager = new ScriptEngineManager();
      ScriptEngine engine = manager.getEngineByName("JavaScript");
      Bindings bindings = engine.createBindings();
      bindings.put("session", session);

      Object result = engine.eval("var v:NotesView = session.getCurrentDatabase().getView('allDocumentsByFormName');print(v.getTitle());"                 
        , 
      bindings);

      System.out.println(result);

but it doesn't work.

Do you have any suggestions?

like image 680
Pudelduscher Avatar asked Mar 30 '26 19:03

Pudelduscher


2 Answers

Don't bother. Your best best is an XAgent that you either trigger using DOTs or through a scheduled agent that calls the URL.

like image 53
stwissel Avatar answered Apr 02 '26 12:04

stwissel


Hmmm.... I do not think that is possible.

One major obstacle to this is that the XPages JVM and the agent manager JVM are not the same. This is why you cannot reuse a Java class (the new design element in 8.5.3) in an agent.

However, the code example you show could easily be coded as a "standard" Java agent just using Java. I know that the example may just be for demonstration purpose - but you have all the backend classes available in Java and therefore you may be able to code what you need in pure Java. It is stable, scalable - as long as you remember to recycle objects (as always in Java) ;-)

/John

like image 35
John Dalsgaard Avatar answered Apr 02 '26 12:04

John Dalsgaard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!