×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Inherit attachment into response doc

Inherit attachment into response doc

Inherit attachment into response doc

(OP)
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!

RE: Inherit attachment into response doc

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.

RE: Inherit attachment into response doc

(OP)
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

RE: Inherit attachment into response doc

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.

RE: Inherit attachment into response doc

(OP)
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!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close