LOTUSSCRIPT/COM/OLE CLASSES


Examples: UniversalID property
This agent creates a new document with a universal ID based on the agent comment.

%INCLUDE "lsxbeerr.lss"
Sub Initialize
 On Error lsERR_NOTES_ERROR Goto processError
 Dim s As New NotesSession
 Dim agent As NotesAgent
 Dim db As NotesDatabase
 Dim doc As NotesDocument
 Dim topicID As String
 Dim universalID As String*32
 Set agent = s.CurrentAgent
 topicID = agent.Comment
 If Len(topicID) <> 8 Then
   Messagebox "TopicID must be 8 characters",, _
   "Not 8 characters"
   Exit Sub
 End If
 Set db = s.CurrentDatabase
 Set doc = New NotesDocument(db)
 Call doc.AppendItemValue("Form", "Main Topic")
 Call doc.AppendItemValue("Subject", "Topic # " + topicID)
 Call doc.AppendItemValue("Categories", "Numbered topics")
 doc.UniversalId = "AAAABBBBCCCCDDDDEEEEFFFF" + topicID
 Call doc.Save(True, False)
 Messagebox doc.UniversalID,, "UNID for new topic"
 Exit Sub
processError:
 Messagebox "This topic already exists",, "Duplicate topic"
 Exit Sub
End Sub

See Also