If need to force response documents to be children of a document, as in my case, someone deleted the original parent and a new parent was created, use this agent. It allows you to select as many documents as you need, prompt/warns you about what you are about to do (allowing cancel), then lets you select the new parent from a view.
Code
Sub Initialize
Dim s As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim docChange As NotesDocument
Dim docs As NotesDocumentCollection
Dim dcNewParent As NotesDocumentCollection
Dim docNewParent As NotesDocument
Dim answer As Integer
Dim strDocType As String
Set db = s.CurrentDatabase
Set docs = db.UnProcessedDocuments
' prompt to confirm that they want to change the selected documents' parent document
answer = Messagebox("You are about to change the hierarchy for the selected documents. Are you sure you want to continue?", 4 + 32, "Change Manager?")
If answer = 6 Then
' prompt for the user to select the new parent from the view "byNominee"
Set dcNewParent = workspace.PickListCollection(1, False, db.Server , db.Filename , "byNominee","New Parent", "Please choose a new parent document.")
If Not dcNewParent.Count = 0 Then
Set docNewParent = dcNewParent.GetFirstDocument
Set docChange = docs.GetFirstDocument
While Not docChange Is Nothing
Call docChange.MakeResponse( docNewParent )
Call docChange.save(True, True)
Set docChange = docs.GetNextDocument(docChange)
Wend
Call workspace.Viewrefresh()
Else
Exit Sub
End If
End If
End Sub