Lotus Notes FAQ Visit Our Sponsor!

How do you add a response's doclink to a parent document?

Assuming you have a way to get to the response document, or you are already in the response document, try this:

Sub PlaceDocLinkInParent (rdoc As NotesDocument)
REM "NOTE" rdoc is supposed to be the response document that you want the 
REM Doc Link for.  As I said above, I will assume you have obtained this and
REM just need to call this procedure to place the doc link.

Dim sess As New NotesSession
Dim db As NotesDatabase
Dim pdoc As NotesDocument
Dim m_unid As String
Dim rt As NotesRichTextItem
Set db = sess.CurrentDatabase
m_unid$ = rdoc.ParentDocumentUNID
Set pdoc = db.GetDocumentByUNID(m_unid$)
Set rt = New NotesRichTextItem(pdoc, "DocLinkField")
Call rt.AppendDocLink(rdoc, "Link To Reponse Document")
Call pdoc.Save(True, False)
End Sub

Basically, this script gets the parent unid from the response, then gets the parent document with the GetDocumentByUNID method, creates a new rich text field in the parent and places a doc link in it.

Applies to Notes Versions: 4 4.5 4.6 5
Last Modified: July 14, 1997