@unique is not a sequential number, its a random number, see the help please
So the user needs the number immidiately? Where is there a problem with a runonserver agent? You can run the agent, wait until its finished and get the number visually back for the user.
See below the bold line:
"If agent.RunOnServer(doc.NoteID) = 0 Then"
Thats the user trigger mechanism. If the numbering process is finished you can reload your doc and get hereby the number for the user.
See the help:
This agent runs the agent named "Agent to be run parameter LotusScript," passing it the note ID of a newly created document.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim agent As NotesAgent
Set db = s.CurrentDatabase
REM Create document containing data to be passed
Set doc = New NotesDocument(db)
doc.TriggerUserName = s.UserName
Call doc.Save(True, False)
REM Start agent and pass note ID of document
Set agent = _
db.GetAgent("Agent to be run parameter LotusScript")
If agent.RunOnServer(doc.NoteID) = 0 Then Messagebox "Agent ran",, "Success"
Else
Messagebox "Agent did not run",, "Failure"
End If
End Sub
This is "Agent to be run parameter LotusScript." It accesses the passed note ID through ParameterDocID, accesses the referenced document, and removes it.
Sub Initialize
Dim s As New NotesSession
Dim agent As NotesAgent
Set agent = s.CurrentAgent
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
REM Get document used for passing data
Set doc = db.GetDocumentByID(agent.ParameterDocID)
REM Send mail containing passed data
Dim memo As New NotesDocument(db)
memo.Form = "Memo"
memo.SendTo = s.UserName
memo.Subject = "Message from LotusScript agent"
memo.Body = "The agent was started by " _
& doc.TriggerUserName(0)
Call memo.Send(False)
REM Delete document used for passing data
Call doc.Remove(True)
End Sub
Hey, Bogdan, you dont like the Help DB, eh?