Domino Code Fragment

Code Name*
Refresh a View from within a Document Using Script in Notes R4
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.17.5.68
Description*
To refresh a view from within a document, you must perform both the backend NotesView Refresh and the frontend NotesUIDocument ViewRefresh methods (before exiting out to the view)
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
 Problem:
In Notes R4, you would like to refresh a view via a script from within a new document.

However, when you save a new document, execute the NotesUIDocument ViewRefresh method,
then exit the document (into a view), the view does not appear to contain the document
you just created. How can you refresh the view from within the document?

Solution:
To refresh a view from within a document, you must perform both the backend NotesView Refresh

and the frontend NotesUIDocument ViewRefresh methods (before exiting out to the view). For
example, the following button script saves the current document, refreshes the view (called

"Main") and then closes the document.

SAMPLE SCRIPT

Sub Click(Source As Button)

'Declare all variables
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim view As NotesView
Dim db As NotesDatabase


'Set all variables
Set uidoc = workspace.CurrentDocument
Set db = session.CurrentDatabase
Set view = db.GetView( "Main" )


'Save current document, refresh "Main" view and close document
Call uidoc.Save
Call view.Refresh
Call workspace.ViewRefresh
Call uidoc.Close


End Sub