RunOnServer calling another database agent

I would like to achieve this in client.

I have 2 different databases (AA & BB). I am running a script from AA database and calling a agent which is in BB database using RunOnServer [ agent.RunOnServer(NoteID)].

Now from BB database is there any way I can get the handle of the NoteID?.

Let me place the code over here so that you can understand my need better.

Code in BB database agent


set sess= New Notessession

Set db = sess.currentDatabase

Set agent = sess.CurrentAgent

NoteID = agent.ParameterDocID

But if you really see in our case we need to get the handle of the AA database not

CurrentDatabase.

I know if I want I can hard code like this

Set db= sess.GetDatabase(“server”,“AA.nsf”)

But like AA there would many dbs calling the agent which is in BB. So I don’t want to hard code it.

So is there any way I can know from which db the agent was called?

Thanks.

Subject: RE: RunOnServer calling another database agent

No, but why are you calling the agent with the handle of a document in the calling database? Why don’t you use a document in the called-to database to provide your parameters?

Subject: RE: RunOnServer calling another database agent

Actually this is the process going on.

We have n number of applications which are handled by one single common processing database.

Application1 , Application2, Application3…

Will pass some parameter to “Common Process” database and “Common Process” do the operation on Application1 db document.

So I can only set the values in Application1 database and then call the agent which is in “Common Process” db.

Subject: RE: RunOnServer calling another database agent

So create a document in the “Common Process” database that contains information about where to find the document in the calling database – server name, filepath, noteID – and call the agent with that new note.

Subject: RE: RunOnServer calling another database agent

Andre, Thanks for your help.