how to display values in glide list variable based on the other variable value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 09:34 PM
Hi All,
I have two variables country(Look up Select box) and site(list collector where we are displaying it as glide_list)
I need to show all the sites which are under that specific country when it is selected.
Both the variables are referring to a custom table(u_sites)
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 09:55 PM
you need to add reference on site field.
https://docs.servicenow.com/bundle/london-platform-administration/page/script/server-scripting/concept/c_ReferenceQualifiers.html
let me know for any query.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 10:02 PM
Yes I am adding the ref qual but eventhough values are not getting displayed in the sites. but I am able to see the values are in the logs but not setting in the variable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 10:16 PM
can you please post variable definition and reference qualifier screenshots?
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 10:58 PM
Site - List Collector
Ref qual - javascript: new PayrollApp.getSiteIds(current.variables.country) ;
on change client script:
var countryIds = g_form.getValue('country');
var siteIds = g_form.getValue('site');
siteIds = siteIds.split(',');
if (siteIds && siteIds.length) {
getSiteIds(countryIds, function (response) {
siteIds = response;
alert('siteIds '+siteIds);
});
g_form.setValue('site', siteIds);
}
function getSiteIds(countryIds, callback) {
var ga = new GlideAjax('PayrollApp');
ga.addParam('sysparm_name', 'getSiteIds');
ga.addParam('sysparm_country_ids', countryIds);
ga.getXMLAnswer(function (response) {
callback(response);
});
when I am printing the alert I am getting the site sys_id but it is not setting in site variable