Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inherit attachment into response doc

Status
Not open for further replies.

ABOzIT

IS-IT--Management
May 1, 2003
226
0
0
JP
I'm designing an application where I need to inherit an attachment that resides in a rich text field on a parent document into a RTF on a response doc.

All the fields on the response that are required to inherit values from the parent are computed with the default values as the parent field. All these are working fine.

The RTF on the parent called "Body" is going to contain text and an attachment. When I create the response doc the text is inherited and the attachment looks like it's there but when you try to launch it I get the error "Note item not found".

I know why this is happening but I don't know how to fix it. Can anyone advise a script or something that's going to create the attachment on the response doc please.

Thanks in advance!

Cheers!
 
Are you saving the document before trying to open the attachment ?
Modifications done by script to a Rich Text field are not taken into account before the document is saved and closed.
 
I'm copying the attachment from the parent document that has already been saved.

I've now worked it out. The following script is in the "Postsave" event for the form and it works just fine.

Sub Postopen(Source As Notesuidocument)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As Notesdatabase
Dim maindoc As NotesDocument
Dim doc As NotesDocument
Dim view As notesview
Set db = session.CurrentDatabase
Set view=db.getview("DocByID")

'Current document
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.document

'Parent Document
ParentID=doc.MainID(0)
Set maindoc=view.getdocumentbykey(ParentID)

If Not maindoc Is Nothing And uidoc.IsNewDoc Then
Set item = maindoc.GetFirstItem("Body")
Call item.CopyItemToDocument(doc, "Body")
End If


End Sub
 
one small suggestion ,

have u tried the option "Inherit entire seleted document in rich text field" .I think this should help u .

This works fine in web.

Check it out.

Kiran.
 
Thanks for the suggestion.

Yes I did try doing it this way but when the document is copied into the RTF you cannot edit it. I needed to be able to make changes to the inherited information.

Good thought though!

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top