g_lsit.refresh() not working in UI action

Mark Wood
Tera Contributor

 

Hello experts,

I have written a UI action script to remove all incidents from a table. When I click on that button, it deletes all the records and refreshes the page. However, the deleted records are still visible until I manually refresh the page. I'm wondering if the g_list.refresh() function is working or not. If it is working, why are the deleted records still showing? Please guide me on this. Thank you.

 

UI action Code

function cleanup()
 {
var gm = new GlideModal("glide_confirm_basic", true, 600);
gm.setTitle("Confirmation");
gm.setPreference("title", "Are you sure you want to delete all closed incident?");
gm.setPreference("onPromptComplete", function () {
 
var gr = new GlideRecord('');
gr.addQuery('state', '7');
// gr.setLimit(2);
gr.query();
 
var deletedCount = 0;
 
while (gr.next()) {
gr.deleteRecord();
 
deletedCount++;
}
 
if (deletedCount > 0) {
alert(deletedCount + " incident deleted successfully.");
// var w = top.gsft_main || top;
//w.location.reload();
g_list.refresh();
//this.window.location.reload();
//location.reload();
} else {
alert("No closed incident found or could not be deleted.");
}
});
 
gm.setPreference("onPromptCancel", function () {
alert("You clicked on 'Cancel'");
});
 
gm.render();
}
 
 
 
 
1 REPLY 1

Anurag Tripathi
Mega Patron
Mega Patron

How is this working?

var gr = new GlideRecord('');

 

 

is your ui action server side or client side?

-Anurag