I have been working through this for about 2 weeks trying different variations and not having complete success. I'm not very good at script,but what I am trying to do it to open the first available, unlocked document in a view through script. This is a work queue and I do not want people to "pick and choose" what they get. All they see in the view is the date a request comes in, and the date it is needed. I started out trying to run an agent to set the fields EscFlag and ProgressFlag, which formulas I have used in an Agent from this forum, but that kept returning to the first document and not stepping down to the next. I tried Nth document but that did not work. Any suggestions would be appreciated. What I am trying to do is on the postopen of the view, check to see which document is "next" in line that has not already been assigned. I am attempting to set the EscFlag to "" and the Progress Flag to the username. I also tried using Get and Set, but no luck there, either. Here is my script: (Now I get an error that "object variable is not set"). I ran this through the debugger but still cannot figure it out. Do I need to put in a Wend somewhere or am I lacking something else?
Sub Postopen(Source As Notesuiview)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim nav As NotesViewNavigator
Dim Doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("HardCopy")
Set nav = view.CreateViewNav
Set entry = nav.GetFirstDocument
Call doc.AppendItemValue _
Call doc.AppendItemValue_ ("EscFlag", "")
Call doc.Save(True, False)
If agent.Run = 0 Then
Messagebox "Agent ran",, "Success"
Messagebox "Agent did not run",, "Failure"
Should I have stuck with the agent? Should I instead use get and set, instead of Append? Was I supposed to declare the Itemvalues separately as variables? Thanks for any information.