Insert Doclink in a RT Field with LS

Hi,

I’m trying to insert in a RT Field, a doclink to a database. I have the right information in my current form (File server & File path).

Everything seems ok when I run the script step by step, but at the end, the field is still empty …

I tried to send this doclink by mail, this way worked perfectly.

I think I missed something, but I don’t know what … !

This is the scripts I created :

1/ My “Save” action :

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim Doc_Current As NotesUIDocument

Set Doc_Current = workspace.CurrentDocument

Call Paste_DbLink(Doc_Current.Document)

Call Doc_Current.Save

Call Doc_Current.close(True)

End Sub

2/ My Script to insert the doclink

Sub Paste_DbLink(Doc_Source As NotesDocument)

Dim session As New NotesSession

Dim Target_Db As NotesDatabase, Current_Db As NotesDatabase

Dim RTItem As NotesRichTextItem

Set Target_Db=session.Getdatabase(Doc_Source.MailServer(0),Doc_Source.MailFile(0))

Set Current_Db=session.CurrentDatabase

Print "File Server : " +Doc_Source.MailServer(0) + Chr$(10)+"Path file : "+Doc_Source.MailFile(0) + Chr$(10)+"Db Title : "+ Target_Db.title

Set RTItem = New NotesRichTextItem(Doc_Source, “DbLink”)

Call RTItem.AppendDocLinkTarget_Db,Target_Db.Title)

Call Doc_Source.save(True,True)

End Sub

If someone has a idea about what is wrong, I’d appreciated.

Thanks.

Sylvain

Subject: Insert Doclink in a RT Field with LS

ok. let’s take a look. you do some funny things. i think a problem could be, that you save the document once in the back end (doc_source) and then in the front end (doc_current)

please try doc_current.reload / doc_current.refresh after your Paste_DbLink function.

This is the scripts I created :

1/ My “Save” action :

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim Doc_Current As NotesUIDocument

Set Doc_Current = workspace.CurrentDocument

Call Paste_DbLink(Doc_Current.Document)

Call Doc_Current.Save

Call Doc_Current.close(True)

End Sub

2/ My Script to insert the doclink

Sub Paste_DbLink(Doc_Source As NotesDocument)

Dim session As New NotesSession

Dim Target_Db As NotesDatabase, Current_Db As NotesDatabase

Dim RTItem As NotesRichTextItem

Set Target_Db=session.Getdatabase(Doc_Source.MailServer(0),Doc_Source.MailFile(0))

Set Current_Db=session.CurrentDatabase

Print "File Server : " +Doc_Source.MailServer(0) + Chr$(10)+"Path file : "+Doc_Source.MailFile(0) + Chr$(10)+"Db Title : "+ Target_Db.title

Set RTItem = New NotesRichTextItem(Doc_Source, “DbLink”)

Call RTItem.AppendDocLinkTarget_Db,Target_Db.Title)

Call Doc_Source.save(True,True)

End Sub

Subject: RE: Insert Doclink in a RT Field with LS

Thanks for your advice.I tryed your solution, but the field is still display empty … I’m very disappointed … :wink:

I fully agree to change the way to script this procedure, I’m not completly obstinate !!

Thanks.

Sylvain