0

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 ?

Keertika
  • 59
  • 6

2 Answers2

1

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…

D.Bugger
  • 2,300
  • 15
  • 19
  • Its not XPages. Its a web based application designed using Javascript. The script library is in JavaScript. The alternative that you mentioned regarding sending an email, I am not clear on this. Do you mean, I should be asking other application to do the update that I am looking for ? – Keertika Jun 14 '22 at 10:11
  • 1
    So what you want is: a way to execute some JavaScript code in the browser, triggered by a LotusScript agent? How is the agent started? Scheduled or using a URL? I'm confused, I don't understand the architecture of your application, where the agent comes in, where the JS runs and how the other application should perform some function... Can you clarify your question? – D.Bugger Jun 14 '22 at 10:24
  • In your agent, you can return a response (using Print statement) and handle that response after an asynchronous call in your front-end javascript. – Tom Van Aken Jun 14 '22 at 14:54
0

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.

leyrer
  • 1,444
  • 7
  • 9