Hello there,I am trying to copy a parent document and all it’s response documents to another database. I am trying to to this through the notes client.
I have a view and when I select the parent document and click a transfer action, only the parent document and the first response document is transferred to the other database. No other response documents are sent. this is the lotusscript behind the transfer action button. Thank you
Sub Initialize
Dim session As New notessession
Dim thisdb As notesdatabase
Dim dc As notesdocumentcollection
Dim doc As NotesDocument
Dim dcResponses As NotesDocumentCollection
Dim otherdb As New NotesDatabase( "", "" )
Call otherdb.Open( "server1", "trackerk.nsf" )
Set thisdb = session.currentdatabase
Set dc = thisdb.unprocesseddocuments
For n = 1 To dc.count
Set doc = dc.getnthdocument(n)
doc.OriginalUNID = doc.UniversalID
Call doc.Save(True, False)
Set newDoc = doc.CopyToDatabase(otherdb)
'transfer doc children, if any
If doc.Responses.Count > 0 Then
Set dcResponses = doc.Responses
For nResp = 1 To dcResponses.Count
Set doc = dcResponses.getnthdocument(n)
doc.OriginalUNID = doc.UniversalID
Call doc.Save(True, False)
Call doc.CopyToDatabase(otherdb)
Next
End If
Next
'notify the user
Set tmpMailDoc = thisdb.CreateDocument
tmpMailDoc.SendTo = "john smith"
tmpMailDoc.Subject = "New document requires your attention"
Set rtitem = New NotesRichTextItem( tmpMailDoc, "Body" )
Call rtitem.AppendText("Please review this document. ")
Call rtitem.AppendText("Open the document by clicking on the following link: ")
Call rtitem.AppendDocLink( newDoc, "New document" )
Call tmpMailDoc.Send(False)
Messagebox "Transfer sent",64,"Document status"
End Sub