LotusScript & Run Agent

Just trying to run agent with 3 lines of formulas… what am I missing? Thanks team…

		Dim session4 As New NotesSession

		Dim db As NotesDatabase

		Dim agent As NotesAgent

		Set db = session4.CurrentDatabase

		Set agent = db.GetAgent("(test)")

Subject: LotusScript & Run Agent

hey dude

you have forgotten to run the agent. unless you run the agent it wont produce any o/p.

so add the line

call agent.run()

that’s it the agent is done.

Subject: RE: LotusScript & Run Agent

Also, look for runonserver() method of Agent class.

–Phani

Subject: RE: LotusScript & Run Agent

Thanks team… was missing the call agent. Will fix…

Subject: RE: LotusScript & Run Agent

OK… made change (see below) but am getting “object variable not set”. I cannot see what is missing? Here is updated script…

Dim session4 As New NotesSession

Dim db As NotesDatabase

Dim agent As NotesAgent

Set db = session4.CurrentDatabase

Set agent = db.GetAgent(“(test)”)

Call agent.run()

Thanks all…

Subject: RE: LotusScript & Run Agent

You didn’t tell us where it failed. You don’t have any error handling. Those would help you a lot. Anyway, the likely problem I see is that it probably is not finding the agent (educated guess). Depending on the type of agent, you don’t actually need parentis actually in the agent name as they get added. First I would recommend some error handling on each SET statement, e.g. If agent is nothing then …

Second, I would recommend adding an ON ERROR statement after the DIM statements to log ERR, ERL, and ERROR with PRINT and/or MSGBOX statements.

Subject: RE: LotusScript & Run Agent

Thanks Doug… will add some error handling. Are you saying that the () are not required around an “agent list” agent? I know it adds them when you choose agent list… just assumed that this was the name.

Subject: parenthesis

dropped a few letters somewhere