IncludeDocLink of Parent - almost there

I have the code below and I have debugged it and it brings in the ParentID. It sends the email, but it doesn’t actually append the doc link. Any ideas?

Dim ws As New NotesUIWorkspace

Dim s As New NotesSession

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim linkdoc As NotesDocument

Set uidoc =ws.CurrentDocument

Set db = s.CurrentDatabase

Set doc = uidoc.Document

parentid=uidoc.FieldGetText(“ParentID”)

Set linkdoc=db.GetDocumentByID(parentid)

recip=“Test User”

subj$=“Test”

msg$=“Test”

MailDocLink db, linkdoc, subj$, msg$, recip

**

Sub MailDocLink(db As NotesDatabase, linkdoc As NotesDocument, subj As String, message As String, recipients As Variant)

Dim memo As NotesDocument

Dim rtitem As NotesRichTextItem

	

Set memo = New NotesDocument( db )

memo.Form="Memo"

memo.Subject=subj

Set rtitem = memo.CreateRichTextItem( "Body" )



Call rtitem.AppendText( message )

Call rtitem.AppendDocLink( linkdoc, "" )



Call memo.Send(False, recipients)

End Sub

Subject: IncludeDocLink of Parent - almost there

Hi Lexi,It might be this line:

Call rtitem.AppendDocLink( linkdoc, “” )

Try changing it to:

Call rtItem.AppendDocLink(linkTo, db.Title )

:slight_smile:

Subject: RE: IncludeDocLink of Parent - almost there

Hi Stan,Thank you for your reply. I tried it, it still doesn’t put the link in the email :frowning:

Thanks anyway.

Subject: RE: IncludeDocLink of Parent - almost there

I see you are also putting ‘message’ into the body field.When the mail arrives, does the body field contain your message?

Subject: IncludeDocLink of Parent - almost there

Lexi:

I just tested the following code and it works. It is called from an action on the response document (for my testing purposes).

Dim ws As New notesUIworkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim memo As NotesDocument

Dim uidoc As NotesUIDocument

Set uidoc = ws.currentdocument

Dim rtf As NotesRichTextItem

Dim parent As NotesDocument

Set db = s.CurrentDatabase

Set doc = uidoc.Document

Set parent = db.getDocumentByUNID(doc.ParentDocumentUNID)

Set memo = db.CreateDocument

memo.SendTo = “TestEmailaddress”

memo.Subject = “Doclink test”

memo.Form = “Memo”

Set rtf = New NotesRichTextItem(memo, “Body”)

Call rtf.AppendText (“Append your comments here”)

Call rtf.Addnewline(2)

Call rtf.AppendText ("Click here to open the parent document ===> ")

Call rtf.AppendDocLink(parent, “Click to open document”)

Call memo.send(False)

Regards,

Dan