developerWorks  >  Lotus  >  Forums & community  >  IBM Lotus Notes/Domino 8.5 Forum (includes Lotus Notes Traveler)

IBM Lotus Notes/Domino 8.5 Forum (includes Lotus Notes Traveler)



Feedback Type Problem
Subject Persnickety LotusScript Error
Product Area Notes Client
Technical Area Application Development
Platform Windows
Release 8.5.1
Hi guys, I'm a newbie to script and looking for some help troubleshooting an agent. I copied a client-run agent (that works fine) to perform a slightly different function. This new agent is throwing an error ('Object variable not set').
In debug mode the failure happens quite early on at 'If item.Values(0)<>"" Then' so I'm guessing I've declared something wrong, but can't seem to figure out what. Any help would be greatly appreciated ;)

Dim conn As Variant
Dim sRoot As String
Dim rs
Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument

Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument()

While Not(doc Is Nothing)
UpdateDoc = False
Set item = doc.GetFirstItem( "ShortName" )

If item.Values(0)<>"" Then strADResult = GetADAccount(item.Values(0),"title")
If strADResult <> "" And doc.HasItem("JobTitle") Then

If Replace(strADResult,","," ") <> doc.GetItemValue("JobTitle")(0) Then
Call doc.ReplaceItemValue("JobTitle", Replace(strADResult,","," "))
Print item.Values(0) & " - Updated JobTitle"
UpdateDoc = True
End If
End If
(and it goes on from there....)

Feedback number WEBBAU6T6Z created by Stacy Elmwood on 01/19/2018

Go back