Respond document not link to parent

What is wrong with this script? It will not display the response document created. I feel it is not link to the parent document. Any suggestions? Parent doc is actually thisDoc. I tried using parDoc by getting it from the unique id. Still not working

Dim ws As New NotesUIWorkspace

Dim s As New NotesSession

Dim db As NotesDatabase

Dim respDoc As NotesDocument		'respond document

Dim thisDoc As NotesDocument

Dim parDoc As NotesDocument

Dim dialog As NotesDocument

Dim uidoc As NotesUIDocument

Dim jlog As String

Dim jlogitem As NotesItem

Dim continue As Variant

Dim noteid As String		'reopen document JA

Dim ndoc As NotesDocument

Set db=s.CurrentDatabase

Set uidoc=ws.CurrentDocument

Set thisDoc = ws.CurrentDocument.Document



If thisDoc.HasItem("Logs") Then

	Set logitem = thisDoc.GetFirstItem("Logs")

Else

	Set logitem = New NotesItem(thisDoc, "Logs", "")

End If



noteid=thisDoc.NoteID

Set parDoc = db.GetDocumentByID(noteid)

Set respDoc = db.CreateDocument()

Call respDoc.MakeResponse(parDoc) 

respDoc.Form="Planned"

continue=True

continue = ws.DialogBox("Planned",False, False,False,False, False, False,"To be allocated to...",respDoc, True) 

Call respDoc.Save(True, True)

Call logitem.AppendText(jlog)	

Call thisDoc.Save(True, False)

Call ws.CurrentDocument.Close(True)



Messagebox "Completed successfully."



'reopen the doc again after everything is done.

Set ndoc =db.GetDocumentByID(noteid)

Call ws.CurrentDocument.Close(True)

Set uidoc=ws.EditDocument(False,ndoc)

Subject: respond document not link to parent

Why not just :

Set uidoc=ws.EditDocument(False,respDoc)

at the end.

(Set uidoc=ws.EditDocument(False,ndoc) will open parent doc)

Subject: RE: respond document not link to parent

will single category embedded view display this response? maybe that is the issue

Subject: reopen parent document

I got the response document working in the embedded view but I cannot reopen the document. Not sure what is wrong.

Dim ws As New NotesUIWorkspace

Dim s As New NotesSession

Dim db As NotesDatabase

Dim respDoc As NotesDocument		'respond document

Dim thisDoc As NotesDocument			'parent document  - write log here

Dim dialog As NotesDocument

Dim uidoc As NotesUIDocument

Dim jlog As String

Dim jlogitem As NotesItem

Dim continue As Variant

Dim noteid As String		'reopen document JA

Dim snotesid As String



Dim ndoc As NotesDocument



Set db=s.CurrentDatabase



Set uidoc=ws.CurrentDocument



Set thisDoc=uidoc.Document



noteid=thisDoc.NoteID

Set thisDoc =db.GetDocumentByID(noteid)

Call thisDoc.ReplaceItemValue("$Ref",thisDoc.UniversalID)





Call thisDoc.Save(True,True)			'save the $ref

If thisDoc.HasItem("Logs") Then

	Set logitem = thisDoc.GetFirstItem("Logs")

Else

	Set logitem = New NotesItem(thisDoc, "Logs", "")

End If



Set dialog=db.CreateDocument		'this document will never be saved JA



continue=True

continue = ws.DialogBox("Plan",True, True, False, False, False, False,"Plan Details...",Dialog, True) 



If continue=False Then				'cancel clicked

	Exit Sub

End If



Set respDoc=db.CreateDocument

respDoc.Form="Plan"

Call respDoc.MakeResponse(thisDoc)



If respDoc Is Nothing Then

	Messagebox "Document is blank..."

	Exit Sub

	

End If



If Not respDoc Is Nothing Then

	

	Call respDoc.ReplaceItemValue("$Ref",thisDoc.UniversalID)

	Call respDoc.ReplaceItemValue("PlanDate",Now)

	Call respDoc.ReplaceItemValue("DealerName",dialog.DealerName(0))

	Call respDoc.ReplaceItemValue("PlannedComments",dialog.PlannedComments(0))

	Call respDoc.ReplaceItemValue("PlanReturnDate",dialog.PlanReturnDate(0))

	

	Call respDoc.Save(True, False)

	

	jlog=" Plan details entered by "+s.CommonUserName+ " to "+Cstr(respDoc.DealerName(0))+"  on "+Now()+"."+Chr$(13)

	

	Call logitem.AppendText(jlog)	

	

	Call thisDoc.Save(True, False)

	

	

End If



Call ws.CurrentDocument.Close(True)

Messagebox "Plan details completed successfully."



'reopen the doc again after everything is done.

Set ndoc =db.GetDocumentByUNID(thisDoc.UniversalID)

Call ws.CurrentDocument.Close(True)

Set uidoc=ws.EditDocument(False,ndoc)

Call ws.CurrentDocument.Close(True)

Subject: RE: reopen parent document

If you call ws.EditDocument, what do you think the current workspacce document is?

Subject: respond document not link to parent

There should be no reason to re-get the current document, but you do need to ensure that the current document has been saved (that is, thisDoc.IsNewNote MUST return false) before you attempt to create the response document.