Link to home
Start Free TrialLog in
Avatar of jkee54
jkee54Flag for United States of America

asked on

Put doclink in new document - need help debugging

I have this code in the post save event of a document that I want to create a new form and have a link in it back to the original.  It won't let me save, giving the error

"Postsave: 23: Not a member: APPENDDOCLINK"

on this line
Call rtitem.AppendDocLink(UIDoc ,"click to open")

I'm a script novice and copied/modified this code from another place where it works, but I must have modified something wrong.

Help!


Dim ws As New NotesUIWorkspace
Dim session As New notesSession
Dim UIDoc As NotesUIDocument 'audit
Dim newdoc As NotesDocument 'mgr review
Dim db As NotesDatabase
Dim rtitem As NotesRichTextDocLink
Dim srce As NotesUIDocument
Set db = Session.CurrentDatabase
Set UIDoc = ws.CurrentDocument
Set newdoc= New NotesDocument(db)
Set rtitem = New NotesRichTextItem(newdoc,"auditlink")
Set srce = ws.CurrentDocument
Set curDoc = srce.Document
Set newdoc = db.CreateDocument
	
If (UIDoc.FieldGetText ("EScore") <96) Then
	Call rtitem.AppendDocLink(UIDoc ,"click to open")
	Call newdoc.ComputeWithForm(True, False)
	Call newdoc.Save(True,False)
End If

Open in new window

Avatar of johnjardin
johnjardin
Flag of South Africa image

Hi There. You cannot pass a NotesUIDocument Object to the appenddoclink method. You can only pass a NotesDocumentObject.

Add the following to your code:

dim doc as NotesDocument


after the code:

Set UIDoc = ws.CurrentDocument

add this code:

set doc = uidoc.Document

then your appenddoclink should look like this:

call rtitiem.AppendDoclink( doc, "click to open" )

hope this helps
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jkee54

ASKER

I appreciate the coaching, especially the time you took to explain.  I  learn best by example, and/or modifying existing code, and your answer went a long way towards helping me.  Thanks!