LotusScript - How to call JavaScript script library function from LotusScript Agent?

465 Views Asked by At

I have a LotusScript Agent that will import a CSV file and update one field value for thousands of documents. Once the field is updated and document is saved, I want to call a JavaScript script library function that in turn calls an API and perform some function in another application. How can I call a JavaScript script library function from LotusScript Agent ?

2

There are 2 best solutions below

3
D.Bugger On

JavaScript? I assume Server-Side JavaScript, in XPages. The only way to “call” such a function is using a URL to an XPage or XAgent that runs the library function.

Or did you have something else in mind?

An alternative would be to send the other application an e-mail…

0
leyrer On

A JavaScript library within the HCL Domino Designer

Domino Designer JS Library screenshot

allows you to store JavaScript classes, functions, and variables for common use within a HCL Domino XPages application. A HCL Domino JavaScript library is either a XPages client library or a XPages server library.

Within an XPage you would call that function, for example inside a button, like this:

<xp:button value="create" id="button1">
    <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
        <xp:this.action><![CDATA[#{javascript:import JSDemoLib;
        demoprint("Hello World!")}]]></xp:this.action>
    </xp:eventHandler>

You can't call/import a HCL Domino Designer JavaScript Library from within a LotusScript agent directly. That is only possible for LotusScript libraries. Your agent would have to do a http request to a Domino server running a XPage application using the JavaScript library in question in order to execute the code contained within the JavaScript library.