uidoc not reloading

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

LVL 1
mikleswAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

madheeswarCommented:
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
0
mikleswAuthor Commented:
     
                     AuditFileUNID=uidoc.Document.ParentDocumentUNID
      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.Location="Basement"
      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")
      uidoc.save
                     Call uidoc.Close(True)            
0
SysExpertCommented:
Did you try adding

uidoc.reload
uidoc.refresh

0
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Bill-HansonCommented:
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?
0
qwaleteeCommented:
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.
0
Bill-HansonCommented:
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.
0
mikleswAuthor Commented:
- 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)

0
mikleswAuthor Commented:
nsd!!!!!!!!!!!!!
0
mikleswAuthor Commented:
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.
0
Bill-HansonCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mikleswAuthor Commented:
I added the following to the response's Initialize sub..

      Dim uiwork As New NotesUIWorkspace
      Set uidoc = uiwork.CurrentDocument
      Call uidoc.FieldsetText("amended","xx")
      uidoc.Refresh
      uidoc.save
      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)


0
qwaleteeCommented:
Well, don't keep us in suspense.  Let us know what you figured out.
0
mikleswAuthor Commented:
for some reason the parent doesn't reload with uidoc.save

the save on the uidoc's backend doc does the trick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.