Manage Learn to apply best practices and optimize your operations.

Force a new parent for a a response

This tip describes how to force documents to be children of a document.

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.


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

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close