roefffisher
roefffisher

Reputation: 1

LotusScript:Agents on schedule does not run DbLookup

I'm writing a LotusScript agent that runs on schedule. In the script, there is a line that goes something like

Dim eval as Variant
eval = Evaluate({@DbLookup( "": ""; "SVR1": "db.nsf"; "aView"; "KeyValue"; 4})

Where SVR1 is the servername, db.nsf is the database, aView is the view and KeyValue is the key used to access the desired record(s). The last number 4 is the column number of the view that we want the value from.

I've been doing this for awhile and no problems. Only now does the script seem not to run on schedule. It works if i run it manually via the designer. I've used NotesLog to do debug and i noticed the agents stops right at that line. The db it is looking up is on another server.

What is causing this script to fail?

Upvotes: 0

Views: 266

Answers (2)

user784540
user784540

Reputation:

Seems that you are trying to connect to the server, different than the agent is running on.

In the old lotus versions there was a strict rule, you was not able to connect to another server in the scheduled agent.

I.e if you ran your scheduled agent on the server: SRV0 you was able only to get information from the server SRV0.

Later (if I recall correctly in Domino 6.0 and later) the new term included: trusted server.

So, if you want to access another server from your scheduled agents you need to register this server as a trusted server.

To add server to trusted servers list, open your server document in the server address book.

Go to Security tab and specify trusted servers in the corresponding field.

Upvotes: 3

nempoBu4
nempoBu4

Reputation: 6621

I recommend to not use the Evaluate in a such way. Instead of this is better to use native LotusScript objects like NotesDatabase, NotesView and so on:

Dim db As New NotesDatabase("", "")
Dim view As NotesView
Dim vc As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim eval as Variant

Call db.Open("SRV1/OrgUnit/Organization", "db.nsf")

Set view = db.GetView("aView")
Set vc = view.GetAllEntriesByKey("KeyValue", True)

If vc.Count = 0 Then
    Exit Sub
End If

Redim eval(vc.Count - 1)

Set entry = vc.GetFirstEntry

index% = -1

Do While Not entry is Nothing
    index% = index% + 1
    eval(index%) = entry.ColumnValues(3)

    Set entry = vc.GetNextEntry(entry)
Loop

Upvotes: 0

Related Questions