Manage Learn to apply best practices and optimize your operations.

Adding Doclink To Uidoc, After The Fact

We had an application that contained portfolio information. Quite often, two
or more portfolios would merge. When this occured, we created a Merge
document. This was a response to the portfolio that was no longer valid, and
contained a doclink to that original document. This merge document, also
required a doclink to the portfolio that remained. Since you cannot insert a
doclink into a uidoc, this was done with the following script in Postopen - so,
the next time the merge document was opened, the doclink would be available.
Sub Postopen(Source As Notesuidocument)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim portDoc As NotesDocument ' remaining portfolio doc
Dim rtitem As NotesRichTextItem ' RT field on merge form
Dim portID As String ' Portfolio ID of
remaining portfolio

Set db = session.CurrentDatabase
Set Source = workspace.CurrentDocument
Set doc = Source.Document
Set view = db.GetView("(ProfilePortfolios)") ' view containing all
portfolio docs

portID = doc.NewPortfolioShortName(0)
Set portDoc = view.GetDocumentByKey(portID, True)
Set rtitem = doc.GetFirstItem( "NewProfileDoc" )

If Source.IsNewDoc Then ' if it's a new document,
then skip
Exit Sub
Elseif Not rtitem.Contains(" - ") Then ' check for leading dash
Call rtitem.AppendText(" - ") ' add leading dash
Call rtitem.AppendDocLink( portDoc, "Link to New Portfolio Profile"
) ' add doclink
Call doc.Save(True, False) ' save current doc
Call Source.Close ' close current doc
Call workspace.EditDocument(False, doc) ' reopen current doc in
editmode
Call doc.Save(True,False) ' resave current doc
End If

End Sub

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close