I have two databases. From DatabaseA I would like to call an agent that then runs an agent in DatabaseB using a document that I’ve passed to it from DatabaseA.
Also is it possible to get any return values from the agent that’s been run in DatabaseB?
Subject: RE: Running an agent in databaseB using a document from databaseA
Okay, I think I got this running an agent from another agent working as I can get the second agent to return Doc.UniversalID of the document that I pass from the first agent.
BUT…
When I use the script Debugger, it doesn’t seem to want to degug the second agent. It debugs the first and then when I “Step Into” the agent.RunOnServer it runs it and stops once it completes the agent.
Subject: RE: Running an agent in databaseB using a document from databaseA
Where are you passing your configuration document?
The answer is: It can’t be done (this way). NotesAgent.Run and NotesAgent.RunOnServer accept a NoteID (not a document object, nor a UniversalID) as the only parameter. As NoteIDs are specific to one database file, you cannot pass on a configuration document from one database to an agent in another database.
The solution is, to create a (temporary) configuration document in the final agent’s database first and pass this NoteID to the agent call.
Personally, I prefer to keep heavily used script libraries in templates and deploy them via design updates (which can be done on a per design note basis).
Subject: Use Script Libraries from a different database
My whole problem is that I’m wanting to access Script Libraries from another database (DatabaseB). I don’t want to copy them over as it means copying a load more that they refer to and pasting them into DatabaseA too.
Subject: RE: Use Script Libraries from a different database
This Designer Help Entry Seems pretty darned clear to me:
Using Script Libraries
Script libraries can contain LotusScript, Java, or JavaScript.
The scope of a script library is the current database. All scripts in a database can avail themselves of the LotusScript, JavaScript, or Java in a library in that database. However, the library is lost to scripts outside the database. For example, if a button in a document uses a script library and you mail the document to or paste it into another database that does not have the same script library, the script fails. If a script attempts to use a library not in the current database, the error message, “Error loading USE or USELSX module” displays.
Whether you WANT to copy the libraries or not is irrelevant. If maintenance is the issue, then have all of the dbs that use a given library inherit the design of the library from the same template.