Creation of response documents for each document in the view

hi!

I have to create response documents for each document in the view code for that is as follows

Set collection = db.UnprocessedDocuments

Set doc = collection.GetFirstDocument()

While Not(doc Is Nothing)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc= ws.ComposeDocument(“”,“”, “form” )

Dim newdoc As NotesDocument

Set newdoc=uidoc.Document

Call newdoc.ReplaceItemValue(“field”,doc.field(0))

Call uidoc.Save

Call uidoc.Close

Set doc = collection.GetNextDocument(doc)

Wend

It works fine but in the view all the created response docs are shown the the document which as the selection cursor

any suggessions?

Subject: creation of response documents for each document in the view

Along with what kiran has mentioned, it is better to add the following line -

doc.$REF = value of parent documents unique id

doc.makeresponse(parentdoc)

…

–Phani

Subject: creation of response documents for each document in the view

Hi Shradha,

You are trying to create only a main document and not a response. You have to use the makeresponse newdoc.MakeResponse( doc ) instead of composedocument method to create response.

Subject: RE: creation of response documents for each document in the view

Thanks…That works but i have another problem…when I set

Set uidoc= ws.ComposeDocument(“”,“”, “response” )

Set newdoc=uidoc.Document

if form properties “formulas inherit values” is cheked - for newdoc variable is not set if it is unchecked then it works fine

I have used same code in other databases and it works

only in this database it gives error i dont know why?