Domino Code Fragment

Code Name*
Attach doclinks to all children
Date*
01/15/1999
Source (or email address if you prefer)*
Mackie
IP address:.3.14.15.94
Description*
Attach links to all "children docs" in parentdoc automatically
Type*
LotusScript
Categories*
User Interface (Notes)
Implementation:
None (plug and play)
Required Client:
(none)
Server:
(none)
Limitations:
Comments:
Attach links to all "children docs" in parentdoc automatically
Files/Graphics attachments (if applicable): Code:
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
             'Set up the UI environment
     Dim ws As New NotesUIWorkspace  
 'Set up the UI environment
     Dim ws As New NotesUIWorkspace
     
     Set uidoc = ws.CurrentDocument
     
     'Set up the backend class environment
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim view As NotesView
     Dim doc As NotesDocument
     Dim backendDoc As NotesDocument
     
     
     Dim dc01 As NotesDocumentCollection
     
     'Create the link to the backend version of the current document
     Set backendDoc = source.Document
     
   'If new doc then exit

     If source.IsNewDoc Then
          Exit Sub
     End If
     
     'This field contains the actual doclink information to plug into the backend document
     Dim rtitem As Variant
     
     Set db = session.CurrentDatabase
     
     'These view is the hidden view that shows the response documents sorted by $REF ID
     Set view01 = db.GetView("(ResponseLU)")
     
     'Set the  document collections
     Set dc01 = view01.GetAllDocumentsByKey(source.Document.UniversalID, True)
     
     'Now there is the loop to update the doclink.
     Set rtitem = New NotesRichTextItem (backendDoc, "LinksToEmails" )        
     Set doc = dc01.GetFirstDocument  
     
     Do While Not (doc Is Nothing)
          Call rtitem.AppendDocLink( doc ,doc.subject(0))
          Call rtitem.AddTab( 1 )
          Call rtitem.AppendText( doc.subject( 0 ) & "  Filed by " & doc.filedby(0))
          Call rtitem.AddNewLine(1)
          Set doc = dc01.GetNextDocument(doc)
     Loop
     
     
     'Save the main document now that all the update document link information has been created.
     Call backendDoc.Save(True, False)
End Sub