Based on choice field value filter the data in reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 06:04 AM
HI There,
in catalog form based on choice field i need to restrcit the data in the referecne field based on choice field.
i written this script but it's not working any one help me what change i need to do in the code.
script include
-------------------
client script (onchange- manufacturer)
---------------------------
Regards,
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 06:15 AM
Hello @gillerlaraj
The script include needs a minor change.
Script Include:
computerTest: function() {
gs.log("inside function");
var gr = new GlideRecord('cmdb_ci_computer');
gr.addQuery('manufacturer.name',this.getParamter('sysparm_value'));
gr.query();
var a = [];
while (gr.next()) {
var computer = gr.getValue('sys_id');
a.push(computer);
}
return "sysidIN" + a.join(',');
},
Note: Make sure script include is not client callable as we are calling it directly from reference qualifier.
Deactivate the onChange client script as this is not required.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 06:20 AM
You don't need the script. In your Computer variable, add a reference qualifier like this:
javascript:'manufacturer.name='+current.variables.manufacturer;
It should look like this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 06:23 AM
Hi @gillerlaraj ,
Check this article and follow steps to fulfill your requirement.
https://www.servicenow.com/community/itsm-articles/dynamic-reference-field-values-based-on-select-bo...
If my answer helped in any way, please mark it as ✅Correct & 👍Helpful
Regards,
Mahathi