Embedded View Not Updating After Save in HCL Notes – Root Cause and Workarounds

:magnifying_glass_tilted_left: Overview

In HCL Notes applications, embedded views are commonly used to display related (child) documents within a parent document. However, developers may encounter scenarios where newly created or updated child documents do not immediately appear in the embedded view after saving.

This blog explains a real-world issue reported by a customer, the root cause, and validated approaches suggested by HCL Support to handle the behavior effectively.

:warning: Problem Description

The customer reported the following behavior:

  • After creating and saving a child document from an embedded view button:

    • First save → No data displayed in embedded view

    • Second save → Duplicate entries appear

  • When using @Command([ViewRefreshFields]) after save:

    • The data appears correctly
  • While editing an existing parent document:

    • Deleting all rows and adding a new child document does not display the first row after closing

:brain: Root Cause Analysis

This issue is not caused by view index corruption.

The actual cause is related to UI refresh limitations in Notes:

  1. Embedded views do not automatically refresh when:

    • A child document is created in a separate window

    • The parent document remains open in the background

  2. The embedded view depends on:

    • View index refresh

    • UI refresh of the parent document

  3. Without explicit refresh handling:

    • First save changes are not visible

    • Subsequent actions may show inconsistent behavior

:white_check_mark: Supported Solution Approaches

Based on the HCL Support investigation, the following approaches were validated.

:check_mark: Approach 1: Refresh View During Child Document Save (Basic Fix)

Use when: Issue occurs during initial child document creation.

Add the following LotusScript code in the Querysave event of the child form:

Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim vw As NotesView

Set db = s.CurrentDatabase
Set vw = db.GetView(“ViewName”)
Call vw.Refresh
Call ws.ViewRefresh

What this does:

  • Forces the backend view index to refresh

    Triggers UI refresh across open views

Limitation:

  • May not fully resolve scenarios involving editing existing parent documents

:check_mark: Approach 2: Synchronize Parent UI on Child Close (Recommended)

Use when:

  • Working with existing parent documents

  • Handling add/delete row scenarios

  • Ensuring first-row visibility after updates

Step 1: Force Parent into Edit Mode

Add in PostOpen event of Parent Form:

If Not source.IsNewDoc Then
source.EditMode = True
End If
Step 2: Refresh Parent After Child Document Closes

Add in QueryClose event of Child Form:

Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim uiDoc As NotesUIDocument
Dim vw As NotesView

Set db = session.CurrentDatabase
Set vw = db.GetView(“ViewName”)
Call vw.Refresh
Call ws.CurrentDocument.Refresh

Set doc = db.GetDocumentByUNID(Source.Document.PUID(0))
Set uiDoc = ws.EditDocument(True, doc, False, “”, False, False)

Call ws.CurrentDocument.Refresh
Call ws.CurrentDocument.GotoField(“Kouji”)
Call ws.CurrentDocument.Refresh

What this does:

  • Refreshes the view index

  • Refreshes the currently open parent document

  • Reopens the parent document in edit mode

  • Forces UI redraw and correct embedded view rendering

:pushpin: Key Observations

  • Embedded views require explicit refresh handling in multi-window scenarios

  • Behavior differs between:

    • New documents

    • Existing documents

  • Parent-child UI synchronization is not automatic

:prohibited: Is This a View Index Issue?

No. This behavior is not related to view index corruption.

Indicators:

  1. Data appears after manual refresh

  2. No backend inconsistency

  3. Behavior depends on UI lifecycle events

:light_bulb: Best Practices

  • Always trigger refresh after child operations

  • Do not rely on implicit UI updates

  • Use a combination of:

    • NotesView.Refresh

    • NotesUIDocument.Refresh

    • ViewRefreshFields

  • Handle both:

    • Save-time refresh (Querysave)

    • Close-time synchronization (QueryClose)

:receipt: Conclusion :

This issue highlights a common limitation in HCL Notes UI behavior where embedded views do not automatically reflect changes made in separate windows.

By applying the above approaches—especially combining view refresh with parent UI synchronization—developers can ensure consistent and reliable embedded view updates.

Disclaimer: The sample code is provided solely as a reference to help guide your implementation. We respectfully recommend that your internal development team review, test, and adapt the code according to your specific environment and requirements. Please note that Product Support is not able to provide customization services or assist with integration into individual customer systems.