uidoc not reloading

miklesw used Ask the Experts™
I have a document with responses displayed in an embedded view.

Actions taken on a response update the status and contents of the log in the parent document.

If I call an action in the parent document which modifies data and saves, before calling an action in the response, the parent status and log are updated (reloaded) when I close the response doc...

However when I open a response, without doing anything to the parent, the status and log aren;'t updated..

Is there a way to avoid this?

uidoc.autreload=true didn't solve the prob..
there are quite a few computed fields but none of them make any changes.. computing their own value

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You need to place your code. Else we don't know how you are accessing parent document.
Use below code to access Parent doc.
Function GetParentDocument( doc As NotesDocument )
      Dim db As NotesDatabase
      Dim parentDoc As NotesDocument
      Set db = doc.ParentDatabase
      If doc.IsResponse Then
            Set parentDoc = db.GetDocumentByUNID _
            ( doc.ParentDocumentUNID )
      End If
      Set GetParentDocument = parentDoc
End Function


      Set docFile = db.GetDocumentByUNID(AuditFileUNID)
      If docFile Is Nothing Then
          Msgbox "Failed to open Audit File Document!!!" ,48,"Accept Retrieval Request"
          Exit Sub
      End If
      docFile.TransactionHistory =Split(Join(docFile.TransactionHistory,";")& ";" & Now & " - " ....
      Call docFile.ComputeWithForm(False,False)
      Call docFile.Save(True,False,False)
      Call uidoc.FieldSetText("ReturnedBy", sess.UserName)
      Call uidoc.FieldSetText("DateReturned",Cstr(Now))
      Call uidoc.FieldSetText("RequestStatus","Returned")
                     Call uidoc.Close(True)            
Top Expert 2007

Did you try adding


Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

The logs are lost because you are saving the parent document in the back-end while it is still open in the front end.

The right way would be to close the parent form while the child is opened for editing, then bring the parent form back up when the child closes.  That way the save to the parent back-end document will not be lost.

Unfortunately, there is a documented bug in the embedded view that prevents us from closing the parent document.  If you try to access a NotesUIDocument in the Queryopendocument event, the Notes client will crash every time.

This code illustrates the bug.  Place this code in the Queryopendocument event of your embedded view to make Notes crash whenever a related document is opened.

      Dim ws As New NotesUIWorkspace()
      Dim uidoc As NotesUIDocument
      Set uidoc = ws.CurrentDocument
      Call uidoc.Save()
      Call uidoc.Close(True)

If IBM would fix this bug, we could develop some very cool relational apps.  Bummer, huh?

Well, you may be able to work around a way to close the parent document.  In the PostOpen event of the child doc, use NotesUiWorkspace to open the parent document then close the returned uiDoc handle.  I have not trie dthis, but it might work, since Notes USUALLY tries to open the existing instance of a document window instead of opening an additional instance.
I've tried using the PostOpen event as a work around, but the side effects were not acceptable; especially then the document is opened via a DocLink.

The workaround that I use is to design the application such that I never write to a parent document while it is open.  For example, I would create the logs as separate, related documents and show those log documents in another embedded view.


- sysexpert, the updates take place in the response.. so the uidoc is the response

- qwaltee, uiwork.editdocument in a form event gives an error  :(

Bill, the queryopendocument thing migth work... If the uidoc.close is causing to crash.. (i hope!)

I will try adding a uidoc.save and see what happens (the parent is reloading if I call an action that edits/saves before opening the response)




I think the only way to solve it, is to get the Parent doc when it is opened  in the same state as when it is edited/saved...

i just have no idea how to get there..

tried saving in the postopen.. but with no results.
The bug prevents any use of the parent.uidoc in queryopendocument of an embedded view.  I've tried every workaround that I can think of to no avail.

One solution that don't really like, but works is this:
1.  Provide an Edit hotspot or button near the embedded view.
2.  When the user clicks Edit, the embedded view is displayed in a picklist.
3.  Operate on the document(s) selected in the picklist

That way, you avoid the embedded view bug, but it is not as clean as if the embedded view bug did not exist.

Also, if you open the document for editing in a dialogbox rather than in the client, you have complete control over the parent form after the response is saved.  Just refresh or reload the form after the call to NotesUiWorkspace.DialogBox.


I added the following to the response's Initialize sub..

      Dim uiwork As New NotesUIWorkspace
      Set uidoc = uiwork.CurrentDocument
      Call uidoc.FieldsetText("amended","xx")
      Call uidoc.Document.save(False,False)

seems to have done the trick... when intiialize runs, the document hasn't gone to the ui yet...

now i just need to add a few checks (that the uidoc is not nothing and is the correct form) and figure out which of the above are really required.. (uidoc.save wasn't enough to have the parent reload on focus)

Well, don't keep us in suspense.  Let us know what you figured out.


for some reason the parent doesn't reload with uidoc.save

the save on the uidoc's backend doc does the trick

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial