سؤال

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?

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

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

I'd suggest writing a scheduled agent in LotusScript instead. I know the syntax might be unfamiliar, but it's an awful lot easier to do something natively than shoe-horning it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top