javascriptlotus-noteslotus-dominolotusscriptlotus

How to call an another agent from same database (replica) but different domino server?


I do have the following situation:

What I want to do is:

My Code:

Dim agent As NotesAgent
Dim sess As New NotesSession    
Dim db As NotesDatabase
Dim doc As NotesDocument    

Set db = sess.CurrentDatabase   
Set agent = sess.CurrentAgent

Call db.Open( "DominoServer2/ORGANIZATION", "ScheduledJobs.nsf" )
Set agent = db.GetAgent("Worker")

// Reason why im using 'run' insted of RunOnServer:
// https://www-01.ibm.com/support/docview.wss?uid=swg1LO42549
If agent.Run() = 0 Then
    Print "SUCCESS"
Else

Problem:

When I run the code there is the following error in console: DIIOP Server: Agent 'RunOn_DominoServer2' error: This database object is already open as D:..(path of the db)..\ScheduledJobs.nsf

Question:

How can I connect to the same database on a different Domino Server and run an agent without issue? Reason: I have to run an agent, which has to be run locally on the target server.


Solution

  • You can configure the other database as a mail-in database, so then you can send a mail with commands and/or data to trigger your Worker agent.