HiWhen a open my db it’s start a agent in postopen.
I run this code:
========
Sub Initialize
Dim wks As New NotesUiWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim SearchView As NotesView
Dim activeDoc As NotesDocument
Dim docColl As NotesDocumentCollection
Dim item As notesitem
Set db = session.CurrentDatabase
Set SearchView = db.GetView( "(CheckActiveUser)" )
Set docColl = searchview.GetAllDocumentsByKey("Active")
If docColl.Count >0 Then
Set activeDoc = docColl.GetFirstDocument
While Not activeDoc Is Nothing
Set item = activeDoc.GetFirstItem("ActiveInThisDB")
If Not item.Contains(session.UserName) Then
' Mark docoment as read.
Call item.AppendToTextList(session.UserName)
Call activeDoc.Save(True,False)
End If
Set activeDoc = docColl.GetNextDocument(activeDoc)
Wend
End If
End Sub
========
It’s set username for the person who open the db in a form with a field. I could be up to 25 users in the same time.
It’s work fine but now will a try to remove the user when they leave the db, how will a do that the easy way.