How do I force a view refresh / page refresh to get the latest data?

Continuing my experiment with using a menu form for default navigation / launch page as well as redirect target after submit. On the menu form I have a table that pulls data from a service call to act as view. Currently this table display documents by date so I have a date field above it that can trigger the service call as well. If I fill in new record and submit then redirect to the menu page, I don't see the record I just submitted.

Even if I try to change the date filter to trigger the service call, the new record I just created still would not show. I have to hit refresh button on the browser to reload the page and then the service call would pick up the record I just created and display it on the table.

Is there a way to programmatically force this refresh ? I have user complaining about their submission not visible and they create again so I ended up with double record. Doing a validation before submit also does not help because all service call cannot find the new data until a physical refresh / reload is done.

Tinus Riyanto - Prisma Global Solusi

Tinus,

I assume the record you are creating is added to the NSF as an 'independent' and not added to the table in form of a 'sub-document'.

Basically what you need is a way to force a refresh. You could do this by having a hidden field that changes value once you have created the new document, and in the onItemChange you call up the service. This would then force a refresh.

Since the menu is a different form than the one that user submit, I don't think it is possible to set a value on a different form that is yet to be displayed. But maybe I can use app.SharedData() variable, I would have to do some test.

I have tried the following :

  1. On the entry form, afterSave event I put in app.getSharedData().RefreshTables = 'true' before I redirect to menu form.
  2. On the menu form, onLoad event I put in a check against the RefreshTables variable and then trigger the service call that populate the tables.

Sometimes it work, the table show the new record when the menu form is displayed. But it doesn't always work so maybe there is some sort of view index that need to be refreshed before the new document can be retrieved via service call ?

Thanks for the tip, interesting strategy you chose.

I don't know if you followed the VOLT events at Digital Week, but there were 4 items that may help in the near future.

They mentionned creating Pages as design elements - hopefully replacing in a better way forms and there was talk of roundtripping which may help solve the refresh issue. And there was talk of a palette item equivalent to a 'goto Form/Page'. And there is the new element called Grid, which is more akin to a Notes view and can be used instead of the table. I'm not sure if this will be in the coming release or only in the following one.

As for now, if I understand right, you 'save' a form and in the closing event you open the menu form. Are you doing it via a step back in the browser history or via an http link ?

I do follow the news regarding Digital Week, but I prefer not keeping my hope up unless they show a demo showing what they mean.

Yes, I force a redirect on the afterSave event using location,replace.

What is the trigger that loads your table? Is it populated on the "onShow" event of the table? You can also set a listener that is fired when the on update (assuming you're updating the table with a custom button and not a "submit" action.

The listener can be found in the Leap wiki: https://hclwiki.atlassian.net/wiki/spaces/HL/pages/461935/Synchronizing+Service+Calls

Yes, the service call run on both table onShow and the date field onChange.

Unfortunately I am not updating the table but submitting a new document that should be displayed on the table once the service call run again. Thus I don't think the onUpdate event would be triggered since I am not directly adding / editing rows on the table.

Doesn't "item.refresh()" from the DataGrid do the trick?
https://help.hcl-software.com/domino_volt/1.0.4/ref_item_objects.html#ref_item_objects__table_jyf_jkq_5qb

Example taken from there (as links might not be working in some distant future):

var srv = form.getServiceConfiguration('SC_theService');
srv.connectEvent("onCallFinished", function(success)
{
  if(success) {
    try {
      appPage.F_DataGrid1.refresh();
    } catch (err) {
      alert("SC_theService: " + err);
    }
  }
});