- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 12:26 AM
Sadly I've found that on catalog items, on a reference variable; on reference attributes; ref_ac_columns breaks after calling the reference variable via g_list.get();
I have a suspicion that it's because I'm using ; to insert multiple fields on ref_ac_columns e.g ref_ac_columns=name;approver;code, and for some reason when using g_list(), it gets confused with ; and now I can only search the reference field with the first declared variable e.g name.
is there anyway to get around this? This is a major pain point as I have to change the reference query with client script after a change of another field, and can only achieve this in client script.
atm my reference attributes is:ref_auto_completer=AJAXTableCompleter,ref_ac_columns_search=true,ref_ac_columns=manager;name;code
and client script affecting this is:
function onChange(control, oldValue, newValue, isLoading) {
/*if (isLoading || newValue == '') {
return;
}*/
if (!isLoading) {
g_form.clearValue('approver');
g_form.clearValue('cost_centre');
}
var collectorName = 'cost_centre';
var type = g_form.getValue('approving_district');
var query = '';
query = '^u_district=' + type;
var queryFin = '^u_active=true' + query;
try { // Service Portal
var myListCollector = g_list.get(collectorName);
myListCollector.reset();
myListCollector.setQuery(queryFin);
} catch (e) {
g_form.setDisplay(collectorName, false);
setCollectorFilter();
}
function setCollectorFilter() {
if (typeof(window[collectorName + 'g_filter']) == 'undefined') {
setTimeout(setCollectorFilter, 100);
return;
}
window[collectorName + 'g_filter'].setQuery(queryFin);
window[collectorName + 'acRequest'](null);
g_form.setDisplay(collectorName, true);
}
}
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 08:10 PM
Hi,
why not use advanced ref qualifier to filter the list collector instead of using above script?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 12:42 AM
Hi,
can you explain what's your business requirement?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 02:00 PM
On cost center, depending on a previous selection i.e ‘District’, we then need to narrow down the cost centers to the ones that belong to that district. To do this I’m setting the query on an onchange client script, on the district variable.
But once calling that cost center reference variable via g_list, everything after the first ref_ac_column does not seem to work anymore.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 08:10 PM
Hi,
why not use advanced ref qualifier to filter the list collector instead of using above script?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 02:23 PM
Ahh, correct. Got to remember to keep it simple. thanks.