Test for response doc before saving main doc

I have a form which uses a response document to create records which belong to the main document. In my submit form validation I need to verify that at least on response was created before saving the main document. I tried using a @SetDocField on the response doc save to set a hidden field on the main doc. In my main doc validation I check to see if this field is blank, which in theory indicates that there are no responses. The problem I’m having is that the main doc needs to be saved to check the value;If (uidoc.Fieldgettext(“Check_Response”) = “” ) Then

	Messagebox "You must create a response document before submitting this request.", MB_OK , "Missing Data"

	Exit Sub

End If

Subject: Test for response doc before saving main doc

The best way to check for a response document is to check the application for a document that has the docid of the main document in the $REF field, but in any case you are still going to have to save the main document to find that out.

I would check for the child document in postsave, then you will get a value to check for whichever way you do it. If nothing is there, set SaveOptions to 0 and warn the user that the document will lost until the child is created.

Hope this helps,

Andrew

Subject: RE: Test for response doc before saving main doc

I’ll try that - Thanks.Here’s what I finally did;

Dim docoll As NotesDocumentCollection

Dim rescoll As NotesDocumentCollection

Dim doc  As NotesDocument

Set doc1 = uidoc.document

Set docoll = db.UnprocessedDocuments

Set doc = doc1



While Not doc Is Nothing

	Set rescoll = doc.Responses

	Set doc = docoll.GetNextDocument(doc)

Wend



If(rescoll.Count = 0 )Then

	Messagebox "You must complete Part B before submitting this request.", MB_OK , "Missing Data"

	Exit Sub

End If