UnprocessedDocuments

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?

Subject: UnprocessedDocuments

Is the view and embedded view?

If so, I’ve read elsewhere ( ) on this forum that you cannot get the Unprocessed documents from an embedded view unless you using an action button on the view itself.

Subject: UnprocessedDocuments

If I get you right, you have an embedded view on that form and a button on the form. Unfortunately, code running in that button does not have direct access to the embedded view. That’s why UnprocessedDocuments will not get the documents, you selected in the embedded view.

I don’t know a simple solution off hands, but I think, that your only option to get the selected documents is from a view action, that you display along with your embedded view. This action - on the other hand - does not have access to the embedding (unsaved) document. I would try something like writing the combobox selection to a profile doc or the envrionment on change and then pick up this value in the view action.

Just a quick shot into the blue.

Subject: RE: UnprocessedDocuments

The Notes Designer helps appears to indicate that this should work.

Subject: RE: UnprocessedDocuments

Could you point me to the document that led you into that assumption?

Embedded views are really elements on their own. They might be embedded into a form, but there is no programmatic interaction. Just try the following: Add a script library to the view and try to call one of that functions in that library from a button on the form or do the opposite and try to use code from a script library, that was added to the form in a view action. It will not work.