How to auto refresh list view of a specific table ?? help required !!

Debashish Paul
Tera Guru

Hi, There is a requirement to auto refresh the list view on an interval of 10 secs and also to add UI Action in the list view , when clicked it should refresh.

I created an UI Action, but the script is not working. can someone please check the script as well the conditions if there is any modifications required ??
Below is the logic that i have added :

***************************************************
function autoRefreshListView() {
// Get the current list view
var listView = GlideList2.get(GlideList2.LIST_VIEWS.INCIDENT);

// Refresh the list view every 10 seconds
setTimeout(function() {
listView.refresh();

autoRefreshListView();
}, 5000); // 10000 milliseconds = 10 seconds
}

autoRefreshListView();

****************************************************
Thanks

3 REPLIES 3

Bert_c1
Kilo Patron

Hi,

 

I have multiple UI Actions in my PDI, named "Refresh". Have a look at those to see what is done.  And please post script logic separately.

Debashish Paul
Tera Guru

Hi @Bert_c1 , thanks for responding !! I have added the logic above.

Why not use the browser's, or Servicenow's context menu, to refresh the list?

 

Screenshot 2024-07-19 130040.png

 

However neither are automatic. And clicking a button is not automatic. Anyway, others here may have suggestions on what you want to do.