I have a form with a drop down combobox and a view.
The dropdown lists the names of our claims adjustors. The view shows claim documents. I want to select an adjustor from the dropdown, then select several claims documents using the views selection margin, then click a button that calls a LS agent to grab the name of the adjustor from the dropdown and place it in a field on each of the selected claim documents.
Here is the code in the agent:
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim adj As String
Set uidoc = workspace.CurrentDocument
adj = uidoc.FieldGetText(“SelectedAdjuster”)
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
If collection.Count = 0 Then
Call aLog.LogAction(“assign claims - nothing selected:”)
Else
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
doc.Adj = Adj
Call doc.Save( False, True )
Set doc = collection.GetNextDocument(doc)
Wend
End If
If I set the agent to run on selected documents, I get a “Document has not been saved yet” error. If I set it any other way, the agent sees no documents regardless of how many are selected.
Any ideas?