Lotus Notes FAQ Visit Our Sponsor!

How do you select multiple documents in a view and run an action button on them?

In your view have a column which creates a check box for the document. A passthru column formula like:
<input type=\"checkbox\" name=\"noteids\" value=\"" + @Text(@NoteID) + "\">

Note that for every document in the view, the check box will have the same Name, ie., "noteids".

Now next step is a $$ViewTemplate for this view. Let it start with a <FORM> tag created using passthru HTML:

<FORM METHOD="POST" ACTION="ProcessNotes?CreateDocument">

This is followed by $$ViewBody and then (using passthru):

<INPUT TYPE="Submit" Name="Action" Value="Action1">
<INPUT TYPE="Submit" Name="Action" Value="Action2">

... etc...
</FORM>

When the view comes up on the browser, the user will see a form with multiple Submit buttons, each corresponding to a certain action to be done on the documents selected through the check boxes.

For the next part of this, you will need to have corresponding fields in a dummy Notes form called "ProcessNotes". A field named "noteids" (text, multivalue, editable) and another by name "Action" (text, editable) and of course a $$QuerySaveAgent. You will get the NoteID of all the checked documents as a multivalue list in "noteids" and the action chosen by the user as a value in "Action" when you get into your QSA. You can use this code to iterate through the document list:

Dim ContextDoc As NotesDocument
Set ContextDoc = session.DocumentContext
ForAll NoteID in ContextDoc.noteids
  set Doc = Db.GetDocumentbyID(NoteID)
  ' Process the note..according to the value of ContextDoc.Action(0)
End ForAll


Applies to Notes Versions: 4 4.5 4.6 5
Last Modified: December 11, 2002