RunOnServer - R7 Item Not found

I am trying to run this simple script and it errors out on the RunOnServer call with a dialog “Notes Error : Notes Item not found” and thats it .

Sub Click(Source As Button)

Dim ses As New NotesSession

Dim db As NotesDatabase

Dim dagent As NotesAgent



Set db = ses.CurrentDatabase

Set dagent = db.GetAgent("TPRSSFlag)")

Call dagent.RunOnServer()

End Sub

The agent I am trying to run is as follows (with security info changed). Simple 6 lines of @Formula. Agent is Trigger on Event, Agent List , Allow restricted ops

TypeMod := ProdType+ProdMod;

test := @DbLookup( “ODBC” :“” ; “BNLDSN01” ; “userid” ; “password” ; “Database” ; “PRODUCT_KEY” : “Discard” ; “PRODUCT_KEY” ; TypeMod ; “Distinct” );

@If(InTPRSS =“Y”;

@If(test = “”;@SetField(“InTPRSS”;“U”);@SetField(“InTPRSS”;“Y”));

@If(test = “”;@SetField(“InTPRSS”;“N”);@SetField(“InTPRSS”;“Y”)));

SELECT Form = “Product R2.0” & rptRFALite = “S”

I am running R7.0 client to a 6.0.2CF2 Server.

Has anybody out there got a simple example of RunOnServer they have working on R7 with agent using @Formula

Subject: RunOnServer - R7 Item Not found

Look the agent name you put in the get agent it’s finished with a parenthesis but doesn’t start with a parenthesis !

Seems to me you didn’t write it well an so the object daagent is not well set !

If your not sure the agent is there test if the object is nothing before doing anything with it.

Hope this helps

Renaud

Subject: RE: RunOnServer - R7 Item Not found

Renaud thanks for your thoughts , but the name is not the problem as this is the way you specify an alias in a “hidden agent” i.e Agent List. I have now re written all ODBC code in Script and run this as scheduled agent, runs fine .

Wrote another agent that did simple Print command on server and tested RunOnServer and worked fine .

Now if I change Print for a call to agent.Run to run the scheduled agent that worked fine, then I get exactly the same error. But the error is generated on the server and not the client.

Subject: RE: RunOnServer - R7 Item Not found

Pete,

As you said it runs on a client but not on the server, the problem is probablybecause when you run it on your server the ODBC datasource is not available.

Is your ODBC datasource defined on your server at the OS level as a System DSN ?

Renaud

Subject: RunOnServer - R7 Item Not found

Problem fixed found issue. I created both agents as manual agents i.e Trigger from “Agent Menu” and all burst into life. So the Note Item not found related to the agent . The key is when specifying a “hidden agent” i.e with brackets around its name .The syntax has to be Call agent.RunOnServer(" (agentname) ") . Spaces before and after are key. This syntax is shown in @Command(RunAgent)