Hi all,
I’m running an agent that collects certain documents from a database and sends some summary information via a rich text field in an e-mail message. The documents were created using different forms. At the end of each summary line, I want to include a link to the specific document. When I use the AppendDocLink method, the links don’t seem to use the “Form” property to display the document correctly. They all use the same form, and I can’t figure out how I can change this behaviour…Here’s a code snippet:
'Loop through new documents and add summary to memo body
While Not ( doc Is Nothing )
Select Case doc.DocType(0)
Case "BulletinBoard"
Call MemoBody.AppendText("BulletinBoard")
Case "Document"
Call MemoBody.AppendText("Documents")
Case "Phonebook"
Call MemoBody.AppendText("Phone book")
End Select
Call MemoBody.AddTab(1)
Call MemoBody.AppendText(Strleft(doc.cPubDate(0)," ",5))
Call MemoBody.AddTab(1)
Call MemoBody.AddTab(1)
Call MemoBody.AppendText(doc.Subject(0))
Call MemoBody.AppendDocLink( doc, doc.Subject( 0 ))
Call MemoBody.AddNewLine(1)
Set doc = view.GetNextDocument( doc )
Wend
I’d appreciate your input…
Thanks
Subject: *Probably the default view uses a form formula
Subject: RE: *Probably the default view uses a form formula
I created a new view from “Blank” and made it the default view…no change.
Subject: Another possibility
Have you looked to be sure there isn’t a view event triggering?
Subject: AppendDocLink uses wrong form
Add a computed when composed field called Form to each of the different forms and compute it to the name of that Form and then see what happens.
Subject: RE: AppendDocLink uses wrong form
Still gives the same result. Even before doing this, when I opened a link and checked the document properties, the value of the Form field was correct…it just wasn’t the form that was used to display the document!
Subject: AppendDocLink uses wrong form
In notes when you get a reference to a NotesDocument object, you will notice that there is a ParentView property that will either be nothing or point to a NotesView.
In the case where the ParentView is nothing, if the document is added as a doclink the view used in the doclink will be the default view in the database. This means that if there is any form formula in the view those properties will be used to launch the document. In the case that there is a view specified that view will be used in the doclink.
If you want to use a specific view to launch the document, the best way is to get a handle on the view you wish to use to launch the document and the do a lookup to get a handle. You will notice that the parent view will then be the view you used to lookup the document.
Another method may be to look at the NotesRichTextItem classes because as of ND6 I think there are some classes that allow you to modify a doclinks properties, eg you could override the default view used.
Anyway hope this helps
–
Regards,
Anthony Lee
anthonyl@bluepoint.net.au