I am programatically adding doc links using Lotus Script and I add it to a computed rich text field. There can be multiple links with text in a rich text field. When the next link is added, the previous link changes from a doc link to a db link. Does anyone know why this happens. It thought having a default form or default view chosen in the database would fix it, but it hasn’t. Here is some of the code:
Any help is appreciated.
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim pdoc As NotesDocument
Dim rtnav As NotesRichTextNavigator
Dim item As notesitem
Dim rtitem As notesrichtextitem
Dim wasEditMode As Variant
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
If uidoc.EditMode Then
Call uidoc.save
wasEditMode = True
Else
wasEditMode = False
End If
Set collection = workspace.PickListCollection( _
PICKLIST_CUSTOM, _
False, _
db.server, _
db.filepath, _
"PIA", _
"Potential Audit Issues", _
"Please select an Issue to add to the PAI Validation Memo." )
If collection.count = 0 Then Exit Sub
Set pdoc = collection.GetFirstDocument
Forall ID In doc.PAIID
If pdoc.UniversalID = ID Then
Msgbox "This issue is already included in this Validation Memo.", 0 + 16, "Error"
Exit Sub
End If
End Forall
Call uidoc.close
'this part calls a sub that appends
'more rich text into different fields
Call AddIssue(pdoc, doc)
Set item = doc.GetFirstItem("PAIID")
Call item.appendtotextlist(pdoc.UniversalID)
'Here is where the doc links and text are added and there can be multiple links and is where I am having the issue
Set rtitem = doc.GetfirstItem("Source" )
Call rtitem.AddNewLine(1)
Call rtitem.AppenddocLink(pdoc,pdoc.ViewTitle(0))
Call rtitem.appendtext(" ")
Call rtitem.AppendText(pdoc.ViewTitle(0))
Call doc.save(True, False)
If wasEditMode Then
doc.saveoptions = "0"
Set uidoc = workspace.EditDocument(True,doc)
Else
Set uidoc = workspace.EditDocument(False,doc)
End If
Set doc = uidoc.document