Process selected documents on the web (v2)

This is a hybrid between my legacy code and ViewProcessor code from Jake Howlett ( 2003). The problem with the legacy code was that $$ViewTemplates don't execute WebQuerySave agents. Attached sample database - Used for the INBOX view template to change the status to "unread" or "saved"
JavaScript • Lotus Formula • Lotus Notes View • LotusScript

This is how it works:

1. User clicks the action button (mark as unread) which performs a javascript loop, creating an array of all $$SelectDoc values on the default Domino form.

2. Then the javascript code passes the array to an additional HTML form appended to the bottom of the $$ViewTemplate.

3. This HTML form has two fields, 'docunids' and 'status' and an action to create a document using a specific form name (another notes form).

4. There needs to be another Notes form in the database with the same form name, two fields and agent called in the WebQuerySave event.

5. The agent called will pickup the values in the "docunids" field and process. $$Return on the Notes form will redirect the browser accordingly.


function doProcess(status) {
	var cb = document.forms[0].$$SelectDoc; 
	var selectcount = 0; 
	var docUNID = new Array();
	for(i = 0; i < cb.length; i ++){
		if (cb[i].checked){
			docUNID[selectcount] = cb[i].value; 
	if (docUNID[0] != null ){
		document.processor.docunids.value = docUNID;
		document.processor.status.value = status;

NOTES AGENT - BatchStatusChangeAgt

Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase 
Dim doc As NotesDocument
Set doc = session.DocumentContext

Dim item As NotesItem
Set item = doc.GetFirstItem("docunids")

Dim value As String
value = doc.status(0)

Dim pdoc As NotesDocument
Forall v In item.values
Set pdoc = db.GetDocumentByUNID( v )
pdoc.status = value
Call True, True)
End Forall

Dim view As NotesView
Set view = db.GetView("inbox")
Call view.Refresh

End Sub

Attached files

Written by Frank Joseph Brefere III

Posted by fbrefere001 on Tuesday March 11, 2008