Hi, folks. I have this in the sub opening a view and am attempting to assign someone’s name and a document lock onto the form. The reasoning behind this is to avoid people picking and choosing which piece of work in a queue that want to open.
Sub Postopen(Source As Notesuiview)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim Doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("HardCopy")
Set doc = view.GetFirstDocument
While Not doc Is Nothing
If doc.EscFlag(0) <> "" Then
Call doc.ReplaceItemValue _
("RetrInit", session.UserName)
Call doc.ReplaceItemValue_ ("EscFlag", "")
Call doc.Save(True, False)
End If
Set doc = view.getnextdocument(doc)
Wend
End Sub
What am I missing? I also need to print the document in question prior to the save, and only continue the “wend” until one is found that does not already have a user name.
Any suggestions appreciated. I mostly use formulas and my scripting is sadly lacking. I turned on the debugger, of course, and know the error is happening on the line that says “Replace Item Value EscValue”. This is further complicated because depending on the type of work that it is, EscValue could have a value depending on whether someone worked on the document earlier. I empty the EscValue button with the following code on a button in a different view that receives the work first:
@If(!@IsNewDoc; @SetField(“AERDate”; @Today); @SetField(“AERDate”; “”));
@SetField(“EscFlag”; “”);
@Command([ToolsRunMacro]; “(UNLOCK)”);
@PostedCommand([EditDocument]; “1”);
@PostedCommand([FileSave]);
@PostedCommand([EditDocument]; “0”);
@PostedCommand([FileCloseWindow]).
The agent for UNLOCK (from this forum and thanks to whoever that was):
@SetField(“EscFlag” ; “”);
@SetField(“ProgressFlag”; “”);SELECT @all.
I had tried to do this with the forum suggestion for both the LOCK and UNLOCK agents run from the view through a button, but because of the workflow pattern thought I’d try to do this by script. Thanks for any suggestions and if you got this far, thanks very much for reading it. Best regards Cathy