Monday, May 04, 2015

Refresh embedded view

Here is the classic old issue. I've a form with embedded view on it (Show single category is used as well). There is an action on a view that create a new documents (which should be displayed in that embedded view). These solutions most likely wont work
  • ws.ViewRefresh will not help
  • Refreshing NotesUIDocument may cause a Notes client to crash, so it is not a way to go as well.
Here are some possible ways to solve it:

Refresh view by simulating of pressing F9

While searching for an example I found it on my blog :-), so you can easily find it here: how to emulate F9 key and save some minutes.

Refresh view by changing focus to another fields

The idea is to have 2 fields (let's call them FieldA and fieldB). Once you need to refresh embedded view - set focus to fieldA and then change it to fieldB. You also need either add refresh logic on Exiting property of fieldA (I prefer it, as it will not cause the perfomance on a form) or enable Automatically Refresh fields.

Refresh embedded view using hidden formula

Here the idea is to make sure we have hidden formula on Embedded View (even such like 1 = 0) and use Refresh
And here is code examples
  Call ws.ViewRefresh
  Call uidoc.RefreshHideFormulas
  Call ws.ViewRefresh

Please have a look on these 2 articles that inspired me:
  1. Refreshing an embedded view
  2. How to refresh NotesUIDocument from categorized embedded view

8 comments :

Anonymous said...

Thank You! Works great, I took the hide-when method, still a work-around but best possible solution I think.

jeff hallett said...
This comment has been removed by the author.
jeff hallett said...

That hide formula and refresh routine worked great! Many thanks.

Anonymous said...

Hide-when trick saved my day ! Thank you !

Anonymous said...

For those in 2018 using R9, a uidoc.Refresh works with no crash.

Anonymous said...

Hi, the refresh hide formulas work like a charm.
I have an embedded view with a multi-value category column.
Thanks from 2022 :)

Scott R said...

Will this work for a form displayed on the web?

Dmytro said...

Hi Scott, I honestly do not know. The article was more about Notes Client.