Append doclink in a button

Hi all, I have my current form to send as a doclink to user’s having higher access roles from a lower ACL user.I knew a form cannot be sent as a doclink, so I’m saving the form in the earlier stage of my code.This gets stored in a view “byname” as soon as i save it. So, I tried to collect the document from the view by passing the user name as key(b’cause his form only need to be sent to another user).

I got a link but prompting a message,“Document cannot be found in the view”…Plz help me with the code…

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim uidoc As NotesUIDocument

Dim db As NotesDatabase

Dim view As NotesView

Dim dc As NotesDocumentCollection

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Set db = session.CurrentDatabase

Set view = db.GetView ("byname" )

Set uidoc=ws.CurrentDocument

key =  uidoc.FieldGetText("emp_name")

Set dc=view.GetAllDocumentsByKey(key,True)

Set doc = dc.GetLastDocument

Set doc = New NotesDocument( db )

Set rtitem=New NotesRichTextItem(doc,"body")

doc.Form = "Memo"	

Call doc.Save(True,False)

doc.sendto=uidoc.FieldGetText("head")

doc.subject="Employee Form"



Call rtitem.AppendDocLink(doc,Here is the link)



Call doc.Send( True)

Call uidoc.Close(True)

If I’m wrong,kindly help me…

Thanks,

Swaroopha

Subject: Append doclink in a button

HIhere is the corrected code…

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim uidoc As NotesUIDocument

Dim db As NotesDatabase

Dim view As NotesView

Dim dc As NotesDocumentCollection

Dim doc As NotesDocument

//*********************************

Dim maildoc as NotesDocument

//*********************************

Dim rtitem As NotesRichTextItem

Set db = session.CurrentDatabase

Set view = db.GetView (“byname” )

Set uidoc=ws.CurrentDocument

Call doc.Save(True,False)

key = uidoc.FieldGetText(“emp_name”)

Set dc=view.GetAllDocumentsByKey(key,True)

Set doc = dc.GetLastDocument

//commented and set maildoc instead of doc

//Set doc = New NotesDocument( db )

Set maildoc = New NotesDocument( db )

maildoc.Form = “Memo”

maildoc.sendto=uidoc.FieldGetText(“head”)

maildoc.subject=“Employee Form”

Set rtitem=New NotesRichTextItem(maildoc,“body”)

Call rtitem.AppendDocLink(doc,Here is the link)

Call maildoc.Send( True)

Call uidoc.Close(True)

Note my comments…

You are resetting doc as mail doc…

Subject: Append doclink in a button

Have you tried calling a view.refresh (this is assuming your using LotusScript to do this).

Ben

Subject: Append doclink in a button

Hi Swaroopha

Some queries …

1> Are you developing Web Based Application / Notes Based ?

2 Are you sending form or document ? ( I think you are tring to send document to another user as doclink )

3 You said you are saving form first ( you mean document ?)

if that document is getting saved then you already have handle to the docuemnt why you need to access it from view again ?

you can create doclink for same document you already have…

Hope this is what you expected…