how to pass sys ids from script include to client script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 11:08 AM
There is a variable on a caltalog item named "IP" which is a reference field....I am stucked at client script...can anyone please help me...
Script Include
var Firewall_IP = Class.create();
Firewall_IP.prototype = Object.extendsObject(AbstractAjaxProcessor, {
PopulatIPsBasedonLoc: function() {
var Loc = this.getParameter('sysparm_location');
var gr = new GlideRecord('ip_address');
gr.addQuery('location', Loc);
gr.query();
var answer = [];
while (gr.next()) {
answer.push(gr.sys_id.toString());
}
return 'sys_idIN' + answer;
},
type: 'Firewall_IP'
});
OnChange Client Script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'IP') {
var grLocation = g_form.getValue('source_location');
var ga = new GlideAjax('Firewall_IP');
ga.addParam('sysparm_name', 'PopulatIPsBasedonLoc');
ga.addParam('sysparm_location', grLocation);
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 11:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 11:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 11:59 AM
Yes Exactly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 12:45 PM
in that case you'd do this in the reference qualifier of the variable, not in a script include.
Your script include will also need to be updated.
var Firewall_IP = Class.create();
Firewall_IP.prototype = Object.extendsObject(AbstractAjaxProcessor, {
PopulatIPsBasedonLoc: function(location) {
var gr = new GlideRecord('ip_address');
gr.addQuery('location', location);
gr.query();
var answer = [];
while (gr.next()) {
answer.push(gr.sys_id.toString());
}
return 'sys_idIN' + answer;
},
type: 'Firewall_IP'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 12:53 PM
Yeah I was aware of that...
But if you see my client script..here my requirement is quite complex...
- If my new value is IP then I need to filter based on the script include conditions...
- if newValue is some other then I have filter based on another field value..
- another field but on same table..
Due to this I didn't prefer reference qualifier...and used onchange client script and script include...
In this way is there is possiblity to filter records? or need to follow only with reference qualifier? if so please help me how can I provide multiple conditions in reference qualifier?