Doc Links change to DB Links

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

Subject: I observer the same…

I observe the same problem in a similiar scenario - in my case the last added doclink gets somehow converted to database link.

Subject: Doclink Changing to DbLink

I am also having the same problem in R8, any solution available for this?

Dim logDoc As NotesDocument		

Dim rtItem1 As NotesRichTextItem

Dim rtStyle As NotesRichTextStyle

Dim item As NotesItem	



Set logDoc = New NotesDocument(db)

Set rtItem1 = New NotesRichTextItem(doc, "HistoryLogLink")

Set rtStyle = ss.CreateRichTextStyle

Set item = New NotesItem (logDoc, "Actions","")



rtStyle.FontSize = 8

rtStyle.NotesColor = COLOR_DARK_MAGENTA

rtStyle.NotesFont = FONT_HELV

rtStyle.Bold = True

actionList = Now() & ": " & ss.CommonUserName & " created profile " & |"| & doc.AccDocID(0) & |".|

Call item.AppendToTextList(actionList)

’ Call item.AppendToTextList(Str(Now()) & ": ")

Call logDoc.MakeResponse(doc)

Call rtItem1.AppendStyle( rtStyle)

Call rtItem1.AppendText("History Log Dcoument <")

Call rtItem1.AppendDocLink(logDoc, "Account Information History" )

Call rtItem1.AppendText(">")



logDoc.Form = "frmAccHistoryLog"

logDoc.CreatedBy = ss.UserName

logDoc.DateCreated = Now()

logDoc.AccDocID = doc.AccDocID(0)



Call logDoc.Save(True, True)

doc.LogDocUnId = logDoc.LogDocID(0)

Call doc.Save(True, False)

Thanks,

-Dinesh