Iterative loop to cascade/stamp all descendant documents

Use this from a single parent document to stamp all descendant documents. The default repsonses method only returns immediate children, not all descendants.
LotusScript

Create a new sub-routine as follows

Sub StampAllDescendants(pdoc As NotesDocument, resps As notesdocumentcollection)
	
	Dim subresps As notesdocumentcollection
	
	Dim rdoc As NotesDocument
	Set rdoc = resps.Getfirstdocument()
	Do
		'stamp this record
		rdoc.FieldA = pdoc.FieldA(0)
		rdoc.FieldB = pdoc.FieldB(0)
		rdoc.FieldC = pdoc.FieldC(0)
		Call rdoc.save(True,True)

		'loop thru its responses
		Set subresps = rdoc.Responses 
		If subresps.count > 0 Then Call StampAllDescendants(pdoc,subresps)
		
		Set rdoc = resps.Getnextdocument(rdoc)
	Loop Until rdoc Is nothing
	
End Sub

Call the new sub-routine from the parent document

'cascade to all descendants
Dim responses As NotesDocumentCollection
Set responses = pdoc.Responses 
If responses.count > 0 Then Call StampAllDescendants(pdoc, responses)

Written by fbrefere001

Posted by fbrefere001 on Wednesday January 14, 2026