- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 06:09 AM
Hi guys,
Is there any way to refresh a related list when a field changes on the form?
For example: if I change the category on an incident form, I would like the related list category-articles to update, without saving the form first.
I tried an onChange client script with the following:
GlideList2.get(g_form.getTableName() + '.REL:31336814db772200e4257cbdae9619f4').setFilterAndRefresh('');
But I am not sure it can work without saving the form, which sort of makes this irrelevant.
Ideas?
harel
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 06:29 AM
The wiki says that g_list is used in UI Context Menus and UI Actions:
GlideList2 (g list) - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 04:07 PM
Hi John,
i try to avoid DOM, but checked it anyway.
I get:
onChange script error: TypeError: Cannot read property 'click' of null function
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 04:34 PM
Can you try
document.querySelector('div.related[tab_caption="Task SLAs"] span.breadcrumb_container a:last-of-type').click();
I replaced :last-child with :last-of-type, which makes this more specific.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:23 PM
Hi John,
onChange script error: TypeError: document.querySelector(...) is null function
My script is very simple- perhaps I am missing something in it:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
document.querySelector('div.related[tab_caption="incident lookup-KB"] span.breadcrumb_container a:last-of-type').click();
}
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:39 PM
Which release are you on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:40 PM
BTW, tab_caption is case sensitive - it has be to capitalized exactly as in your Related List label (what you see on the form). Can you double check, please?