Getting Info From Parent To Child "After" Child Is Created

What is the best way to get some field values from a parent document down to the child document “after” the child document has already been created & saved? I currently have several fields that are inherited from the parent document when the child is created (computed when composed) and works great. But I now need several additional field value pulled from the parent to the child to update all the existing child documents. After that is done I plan to then change the new child fields to computed when composed). Any suggestions to update the existing ones ?

Subject: Getting Info From Parent To Child “After” Child Is Created

Heres what I use:

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim Collection As NotesDocumentCollection

Dim Doc As NotesDocument

Dim Form, ParentStatus, Status As String

Dim ParShort, ParFirst, ParMid, ParLast As String

Dim RecShort, RecFirst, RecMid, RecLast As String



Set Doc = Source.Document	



If Not Source.IsNewDoc Then

	Set Collection = Doc.Responses

	ParentStatus = Source.FieldGetText("LNFullName")

	ParShort = Source.FieldGetText("LNShortName")

	ParMid = Source.FieldGetText("AMiddleName")

	ParFirst = Source.FieldGetText("AFirstName")		

	ParLast = Source.FieldGetText("ALastName")

	Set Doc = Collection.GetFirstDocument

	

	While Not ( Doc Is Nothing )

		Form = Doc.GetItemValue("Form")(0)

		Status = Doc.GetItemValue("LNFullName")(0)

		RecShort = Doc.GetItemValue("LNShortName")(0)

		RecFirst = Doc.GetItemValue("RecAFirstName")(0)

		RecMid = Doc.GetItemValue("RecAMiddleName")(0)

		RecLast = Doc.GetItemValue("RecALastName")(0)			

		

		If (Form = "DeptAsm") Then

			Call Doc.ReplaceItemValue( "LNFullName", ParentStatus)

			Call Doc.ReplaceItemValue("LNShortName",ParShort)

			Call Doc.ReplaceItemValue("RecAFirstName",ParFirst)

			Call Doc.ReplaceItemValue("RecAMiddleName",ParMid)

			Call Doc.ReplaceItemValue("RecALastName",ParLast)

			Call Doc.Save (True, False)

		End If

		

		If (Form = "AsgSvcCtr") Then

			RecShort = Doc.GetItemValue("RecLNShortName")(0)

			Call Doc.ReplaceItemValue( "RecLNFullName", ParentStatus)

			Call Doc.ReplaceItemValue("RecLNShortName",ParShort)

			Call Doc.ReplaceItemValue("RecAFirstName",ParFirst)

			Call Doc.ReplaceItemValue("RecAMiddleName",ParMid)

			Call Doc.ReplaceItemValue("RecALastName",ParLast)

			Call Doc.Save (True, False)

		End If

		

		Set Doc = Collection.GetNextDocument(Doc)

		

	Wend

	

End If

End Sub

Subject: Getting Info From Parent To Child “After” Child Is Created

Alternatively, if you want a simpler, formula-based option, here’s my agent, set to run on all documents in a view that selects the documents with the incorrect data:

SELECT @IsResponseDoc;

FIELD ProjectName := @GetDocField($Ref; “ProjectName”);

FIELD DRSProNo := @GetDocField($Ref; “DRSProNo”);

FIELD WVIProNo := @GetDocField($Ref; “WVIProNo”);

@All

Helen Carter.

Subject: RE: Getting Info From Parent To Child “After” Child Is Created

Thanks Brian & Helen for both of your suggestions. I used Helen’s suggestion because I have very little experience in Lotus Script. It worked great !