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
Gerard O'Sullivan posted this more general-purpose solution to place in the QuerySave event (the above solution only goes down one level):
%REM ************************************************************** Function: UpdateResponseDocs Input(s): Nothing Output(s): Nothing Purpose: Updates the appropriate fields in the response docs by replacing the appropriate item values from the the parent **************************************************************** Authored By: Ger O'Sullivan Authored Date: 07-Mar-2002 Last Modified By: Ger O'Sullivan Last Modified Date: 07-Mar-2002 %END REM Sub UpdateResponseDocs() RoutineName="UpdateResponseDocs" Dim arr_fieldsToSet(6) As String arr_fieldsToSet(0) = "<fieldName_0>" arr_fieldsToSet(1) = "<fieldName_1>" arr_fieldsToSet(2) = "<fieldName_2>" arr_fieldsToSet(3) = "<fieldName_3>" arr_fieldsToSet(4) = "<fieldName_4>" arr_fieldsToSet(5) = "<fieldName_5>" arr_fieldsToSet(6) = "<fieldName_6>" Call RecursiveSetResponseDocs(note, arr_fieldsToSet) End Sub %REM ************************************************************** Function: RecursiveSetResponseDocs Input(s): NotesDocument Variant Output(s): None Purpose: Loop through the list of response documents, checking to see if these responses have responses themselves. We do this by recursively calling the same function but passing the response object instead. **************************************************************** Authored By: Ger O'Sullivan Authored Date: 07-Mar-2002 Last Modified By: Ger O'Sullivan Last Modified On: 07-Mar-2002 %END REM Sub RecursiveSetResponseDocs(_ doc As NotesDocument, _ v_fieldsToSetList As Variant) RoutineName = "RecursiveSetResponseDocs #1" Dim item As NotesItem Dim threadIndent As String Dim collection As NotesDocumentCollection Dim currentResponse As NotesDocument Dim s_fieldToSet As String 'With the current doc object, get a collection of it's responses Set collection = doc.Responses 'Ensure that we have a vald collection otherwise, skip on to the next document. 'If (collection.Count > 0) Then RoutineName = "RecursiveSetResponseDocs #2" 'Get a handle on the first document Set currentResponse = collection.GetFirstDocument 'Loop through the list of response documents, checking to see if these responses have responses 'themselves. We do this by recursively calling the same function but passing the response object instead. While Not ( currentResponse Is Nothing ) Forall v_fieldToSet In v_fieldsToSetList s_fieldToSet = Cstr(v_fieldToSet) 'Get a handle on the item Set item = doc.GetFirstItem(s_fieldToSet) If (currentResponse.HasItem(s_fieldToSet)) Then If (item.Type = RICHTEXT) Then Call currentResponse.ReplaceItemValue(s_fieldToSet, item.text) Else Call currentResponse.ReplaceItemValue(s_fieldToSet, item.values) End If Else Call currentResponse.CopyItem(item, "") End If End Forall Call currentResponse.Save(True, False) ' Recursive call. Check for response to responses Call RecursiveSetResponseDocs(_ currentResponse, _ v_fieldsToSetList) RoutineName = "RecursiveSetResponseDocs #3" Set currentResponse = collection.GetNextDocument( currentResponse ) Wend End Sub