Domino Code Fragment

Code Name*
Update a field in all the response documents from a field that has changed in the parent document.
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.222.121.170
Description*
The following LotusScript which will take a value in the parent document and push it
down into all the response documents. Place the script in the Querysave event of your parent form.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
    Dim Collection As NotesDocumentCollection
    Dim Doc As NotesDocument
    Dim Form, ParentStatus, Status As String
   
    Set Doc = Source.Document
   
    If Not Source.IsNewDoc Then
         Set Collection = Doc.Responses
         Set Doc = Collection.GetFirstDocument
         ParentStatus = Source.FieldGetText("FieldInParentDocument")
                   
         While Not ( Doc Is Nothing )
              Form = Doc.GetItemValue("Form")(0)
              Status = Doc.GetItemValue("FieldInResponse")(0)
             
              If (Form = "Response Form") Then
                   Call Doc.ReplaceItemValue( "FieldInResponse", ParentStatus)
                   Call Doc.Save (True, False)
              End If
              Set Doc = Collection.GetNextDocument(Doc)
         Wend
         
    End If
End Sub