Search This Blog

Thursday, July 2, 2020

Critical bug - manual changes on the form are discarded by action in embedded view

Hi

Not sure how I missed this bug for so many years of working with Notes but here it is what I discovered recently:

1) Imagine you have a form with a single field (dialog list) + embedded view.

2) Embedded view has a single action with following simple code


3) Then create a new document with this form, save the document, then change value of a field and click action in embedded view - your last change to the field is reverted to previous value somehow?!
See video:

I found two workarounds to avoid this issue:
1) Call NotesUIDocument.Save() before using doc.replaceItemValue in action of the embedded view


Sub Click(Source As Button)
Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Set uidoc = w.currentdocument
Set doc = uidoc.Document
Call uidoc.Save() '<----------
Call doc.ReplaceItemValue("aaa", "bbb")
End Sub

2) Call NotesUIDocument.refresh(false) before using doc.replaceItemValue in action of the embedded view

Sub Click(Source As Button)
Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Set uidoc = w.currentdocument
Set doc = uidoc.Document
Call uidoc.Refresh(false/true) '<----------
Call doc.ReplaceItemValue("aaa", "bbb")
End Sub

The first option can be unacceptable by application logic because users lose the ability to quit from a document without saving it.

The second option will not work if you use the property "Show single category" for embedded view - NotesUiDocument.refresh(false/true) will end with Notes crash.

This bug is reproducible for Notes 8.5x, 9x and 11x.

No comments:

Post a Comment