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 12:56 PM
Not via a client script. You'll need to handle the logic in the script include by checking the passed value and either returning nothing or your filter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 06:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2021 07:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2021 10:30 AM
Hey Sathwik,
Check if you got the solution and if not then can you please explain me in one reply or another question. everything in consolidated format
Quite a long thread to go through

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2021 12:47 AM
No, you can't achieve what you want via a client script. You have to use a reference qualifier to change what records are visible in a list collector or reference field.
var Firewall_IP = Class.create();
Firewall_IP.prototype = Object.extendsObject(AbstractAjaxProcessor, {
PopulatIPsBasedonLoc: function(location) {
if(location != 'IP')return;
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'
});