Retrieving Doc Link

From within a document, I have an action button launches a different document copying various data from the originating document.

Is there a way to query the doc link info from the originating document and transfer it to the new document so it is available for the user to click back to the original document?

My code is below if it helps…

Thanks, Paul

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim workspace As New NotesUIWorkspace

Dim collection As NotesDocumentCollection

Set db=session.CurrentDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument	

Set uidoc=workspace.CurrentDocument

Set doc=uidoc.Document

Dim newdoc As NotesDocument

Set newdoc = New NotesDocument( db )



newdoc.Form = "Burn-In\Bib Set Order Form"

'Data Transfer:

newdoc.FromProductForm = "Y"

newdoc.BIProductName = doc.BoardName

newdoc.BIProductNameComp = doc.BoardName

newdoc.CreatedOn = Evaluate("@Now")

newdoc.SubOn = Evaluate("@Now")

newdoc.CreatedBy = Evaluate("@Name([CN];@UserName)")

newdoc.CreatedBy_Display = Evaluate("@Name([CN];@UserName)")



Call newdoc.Save(True,True)

Call workspace.editDocument(False,newdoc)

End Sub

Subject: Are you just asking can a doclink pointing to the original document be placed on the new document?

Hi, Paul. Are you just asking can a doclink pointing to the original source document be added to the new document? If you are, sure, that can be done. Just define a Notesrichtextitem object and then use the AppendDocLink method to append a doclink pointing to the original document to the newly created rich text field. Of course, you will need a rich text field defined on the new form so the rich text field you created will be displayed.

Dim newrtitem As NotesRichTextItem

Set newrtitem = New NotesRichTextItem( newdoc, “Body” )

Call newrtitem.AppendDoclink(doc,“doclink to original document”)

Subject: Looks good but need more detail

Dave,

This looks exactly like what I need but unfortunately, I have very little experience with script. Would you help with a little more detail? I added my new document rich text field “SocketAttachments” but do not know what to enter for the “Body” and “doclink to original document” strings.

Set SocketAttachments = New NotesRichTextItem(newdoc, “Body” )

Call SocketAttachments.AppendDoclink(doc,“doclink to original document”)

I think that is all that I am missing. I also added the Dim newrtitem As NotesRichTextItem declaration at the top…

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim workspace As New NotesUIWorkspace

Dim collection As NotesDocumentCollection

Set db=session.CurrentDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument	

Set uidoc=workspace.CurrentDocument

Set doc=uidoc.Document

Dim newdoc As NotesDocument

Dim newrtitem As NotesRichTextItem

Thanks so much!!!

…Paul

Subject: Further Information

Hi, Paul. I think you really need to examine the Lotus Domino Designer 8.5 Help to get more familiar with LotusScript. There are examples in that help database that will get you on the right track as a developer. I think you are misunderstanding how to use the NotesRichTextItem object. If you declare newrtitem as your NotesRichTextItem object, then there is a contradiction in using SocketAttachments as your NotesRichTextItem object. The “doclink to original document” portion of the code is just the text that appears when a user presses and holds the mouse pointer over the doclink. You can change that to whatever you want. The former “Body” portion of the code is the name of the field on the new document. Here is what your code should probably look like:

Set newrtitem = New NotesRichTextItem(newdoc, “SocketAttachments” )

Call newrtitem.AppendDoclink(doc,“doclink to original document”)

Subject: Thanks

Thanks Dave… I actually started using embedded views to accomplish a link but really appreciate your help. May try the doc link in the future.

Take care, Paul