In our version of a discussion database, Main Topics are questions and all responses (the answers) are created by the "authority" on the topic. While the database uses a standard discussion template, it is really more like an FAQ database than a discussion. Since our purpose is to show questions with answers, we did not want to show the Main Topic documents (the questions) until there was a Response document (the authoritative answer).
To accomplish this, the "authorities" who create responses have the role "[Responders]" assigned in the database ACL. "[Responders]" is the default value of "HideIfNoResponse," a readers field on the Main Topic form.
Default access for the database is set to Author (so anyone can write questions) with the role "[ReadFAQs] assigned."
When a Response document is submitted by an "Authority," the WebQuerySave event runs the following agent which replaces the role "[Responders]" with the role "[ReadFAQs]."
The readers field roles make documents "invisible" to all but "Authorities" until a Response document is created. Then they appear in views for all readers.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim ResponseDoc As NotesDocument
Dim MainDoc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("Parent Lookup") ?a view with a sorted first column
?@Text(@DocumentUniqueID), used as a lookup key.
Set ResponseDoc = session.DocumentContext 'returns the backend NotesDocument being displayed by the Web Browser
Set MainDoc = view.GetDocumentByKey (ResponseDoc.Parentdocumentunid,True)
Call MainDoc.Save (True,True)