Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to display values in glide list variable based on the other variable value

sk59
Tera Expert

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)

 

5 REPLIES 5

Ahmmed Ali
Giga Sage
Giga Sage

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

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

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

can you please post variable definition and reference qualifier screenshots?

 

Thanks,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

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