- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2016 04:08 PM
Hello folks,
How can i refresh a list in a tab in a form with client script on the form? For example, when a record is saved, the Task SLAs tab does not immediately get updated, and the users need to click the Task = Form for Processing link (see below) to refresh the list.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2016 09:56 PM
Hi George,
I tried and here is the final script you have to write.
Script :
function onLoad() {
//Type appropriate comment here, and begin script below
GlideList2.get(g_form.getTableName() + '.task_sla.task').setFilterAndRefresh('');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2016 05:24 PM
You can achieve this by below piece of code in your client script. You need to execute this based upon some logic
setTimeout(function(){ GlideList2.get("your_table_name").refresh(); }, 2000);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2016 08:56 PM
Thank you for this tip, I have referred to Pradeep's wiki, and use the code below
function onLoad() {
try {
var elementLookup = $$('div.tabs2_list');
var listName = "Task SLA";
for (i = 0; i != elementLookup.length; i++) {
if (elementLookup[i].innerHTML.indexOf(listName) != -1) {
var listHTML = elementLookup[i].id.split('_');
var listID = listHTML[2];
nowRefresh(listID);
}
}
}
catch (err) {
alert(err.message);
}
function nowRefresh(id) {
GlideList2.get(id).refresh('');
}
}
I don't understand why it pops 'undefined' on GlideList2.get(id).refresh('');, the tab does not have a refresh button, does this make a difference?
Any advice would be appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2016 05:44 PM
Hi George,
The below blog should answer your question.
Reload a Form or Related list from a Client Script - ServiceNow Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2016 08:27 PM
Thanks Pradeep, I refer to the form, and have the code as a new client script on form_load
function onLoad() {
try {
var elementLookup = $$('div.tabs2_list');
var listName = "Task SLA";
for (i = 0; i != elementLookup.length; i++) {
if (elementLookup[i].innerHTML.indexOf(listName) != -1) {
//alert ('element ' + elementLookup[i].innerHTML + ' found');
var listHTML = elementLookup[i].id.split('_');
alert ('listHTML=' + listHTML);
var listID = listHTML[2];
alert ('listID=' + listID);
//nowRefresh(listID);
}
}
}
catch (err) {
alert(err.message);
}
function nowRefresh(id) {
GlideList2.get(id).refresh('');
}
}
When form loads, it pops up with the warnings,
If you could help, it would be greatly appreciated.
Regards,