Lotus Notes FAQ Visit Our Sponsor!


How do you update a field in response documents after it is changed in the parent document?

Assumptions:
1) The name (or synonym) of the Response form is "TASK" and it inherits field values.
2) The name of the field to synchronize is "STATUS" in both Project and Task forms. This is computed when composed to inherit from the parent form.

Include the following Script code in the QuerySave event of the parent form:

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
  Set Collection = Doc.Responses
  Set Doc = Collection.GetFirstDocument
  ParentStatus = Source.FieldGetText("STATUS")
  While Not ( Doc Is Nothing )
    Form = Doc.GetItemValue("Form")(0)
    Status = Doc.GetItemValue("Status")(0)
    If (Form = "TASK")And (Status <> ParentStatus) Then
      Call Doc.ReplaceItemValue( "STATUS", ParentStatus )
      Call Doc.Save (True, False)
    End If
    Set Doc = Collection.GetNextDocument(Doc)
  Wend
End Sub

Applies to Notes Versions: 4 4.5 4.6 5
Last Modified: January 14, 1998
Home *Notes R3 *Notes R4 *Notes/Domino 4.5 *Notes/Domino 4.6 *Notes/Domino R5