onchange client script for a list collector
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-28-2018 02:55 PM
I have a requirement on catalog item , on the change of a variable, a list collector will show up and we need to filter the values in the list collector (active=true) , i know we can achieve this by defining the ref qual condition in the list collector but we have another use case . so can some one please help me with the code ?
Thanks in advance
16 REPLIES 16

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-29-2018 07:49 AM
try below
function onChange(control, oldValue, newValue, isLoading) {
//Apply a default filter to the list collector variable
var collectorName = 'netid_beaker';
var filterString = 'active=true';
//Try Service Portal method
try{
var myListCollector = g_list.get(collectorName);
myListCollector.reset();
myListCollector.setQuery(filterString);
}
//Revert to Service Catalog method
catch(e){
//Hide the list collector until we've set the filter
g_form.setDisplay(collectorName, false);
setCollectorFilter();
}
function setCollectorFilter(){
if(typeof(window[collectorName + 'g_filter']) == 'undefined'){
setTimeout(setCollectorFilter, 100);
return;
}
//Reset the filter query
window[collectorName + 'g_filter'].reset();
window[collectorName + 'g_filter'].setQuery(filterString);
window[collectorName + 'acRequest'](null);
//Redisplay the list collector variable
g_form.setDisplay(collectorName, true);
}
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-29-2018 07:55 AM
still not working