Unknown Lotusscript error

Hello all:

I am trying to run two agents on server from a button what I do is use this code and change agent names

Sub Click(Source As Button)

Dim db As notesdatabase

Dim session As notessession

Set Session = New NotesSession

Set db = session.currentdatabase

Dim Agent As NotesAgent

'Set Agent = db.GetAgent("Retrieve OPS Details Data")

Set Agent = db.GetAgent("trial like human resource")

Call uidoc.save

Call Agent.RunOnServer(doc.NoteID)

End Sub

first agent runs perfectly the second agent gives me an error “Unknown LotusScript Error”

in this line of code

Call Agent.RunOnServer(doc.NoteID)

agents proerties are the same

the same user is running both agents

what did I do wrong

thanks

Dalia

Subject: Unknown Lotusscript error

That error usually occurs when one runs agent code programmatically that contains UI elements / functionality. This can’t be done, because NotesAgent.Run() is a back-end operation.

Subject: RE: Unknown Lotusscript error

thanks again for your feedback when I checked my log I found this

error: Instance member DOCUMENTCONTEXT does not exist

as I am trying to declare the current document that the agent run from,so what is the solution in this case ,as I need to use values from the current document and I need the agent to run on server as well

when I tried session.unprocesseddocument I had the same error

thanks again

Dalia

Subject: DocumentContext in a server agent

You’re running this on the server. The server doesn’t have access to your workstation environment to know which is the current document that you have open. You’ve made a good start by supplying the document note ID as an argument to RunOnServer, but the server agent doesn’t automatically look up the document – you have to program that. Read about ParameterDocID in the Domino Designer help.

Subject: RE: DocumentContext in a server agent

Also, there is a detailed article in the Agent FAQ called “Run and RunOnServer, passing parameters” that might be helpful:http://www-10.lotus.com/ldd/46dom.nsf/7e6c7e584a76331b85256a46006f083e/574c99ccb345839185256976004e811e?OpenDocument