I'm looking for a way to in an hierarchical view, have a "Move" button to move a response doc (and all its children with out loosing its structure)to a different father doc.
Response documents maintain their relationship with their parent document via the $Ref field. This field contains the DocumentUniqueID of the document to whom this document is a response. Using LotusScript, you can manipulate the parent-children relationships of documents easily.. here is a quick example that will take a response document that is a response to ParentDoc1 and make it instead a response to ParentDoc2. You can make it is complex as you need just as long as you maintain the $Ref field, everything will be fine.
(I have left out some declarations for the sake of brevity, such as thisDB definition, the name should be clear enough)
Dim OldParent, NewParent, ChildDoc as NotesDocument Dim ParentColl, RespColl as NotesDocumentCollection Set ParentColl = thisDB.UnProcessedDocuments Set OldParent = ParentColl.GetFirstDocument Set NewParent = myView.GetDocumentByKey("WhateverKeyFindsNewParent") Set RespColl = OldParent.Responses If RespColl.Count > 0 then Call RespColl.StampAll("$Ref",NewParent.UniversalID(0)) End If
This was first published in December 2001