Subject: RE: Schedule Agent
So something like this:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim col As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim doc As NotesDocument
Dim days As Integer
Dim status As String
Dim claimedby As String
Set db = session.CurrentDatabase
'*** Get hidden lookup view, never use
'*** views visible to users for lookups
Set view = db.GetView(“LookupPending”)
'*** Get all entries in view
Set col = view.AllEntries
'*** Loop thorugh all view entries
Set entry = col.GetFirstEntry()
Do Until doc Is Nothing
'*** Read values from columns
status = Cstr(entry.ColumnValues(0)) ’ First column is status
days = Cint(entry.ColumnValues(1)) ’ Second column is days
claimedby = Cstr(entry.ColumnValues(2)) ’ Third column is
'*** Now when we have the vlaues, let’s do stuff…
If days>=18 Then
Set doc = entry.Document
Call doc.ReplaceItemValue(“DocStatus”,“Retention”)
Call doc.Save(True,False)
Else If claimedby<>“” Then
Set doc = entry.Document
Call doc.ReplaceItemValue(“DocStatus”,“Claimed”)
Call doc.Save(True,False)
Else If status<>“Pending” Then
Set doc = entry.Document
Call doc.ReplaceItemValue(“DocStatus”,“Pending”)
Call doc.Save(True,False)
End If
Set entry = col.GetNextEntry(entry)
Loop
This is untested code, and I am making some assumptions. You may want to think through the logic and make sure this is how you want it to work as well.