- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 04:03 AM
If a business unit is selected only the departments related to that business unit should be visible in the department reference field, both business unit and department fields are reference type fields, I have written a script include for the advanced reference qualifier, but it is not working
Script Include
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reference Qualifier
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
javascript:new PopulateDepartment().getDepartment(current.u_sbu_ssu) + '^u_active!=false';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 04:12 AM - edited 02-14-2025 04:15 AM
Change your return line to
return 'sys_idIN' + departmentList.join(',');
and you don't really need the concatenated part on the Reference Qualifier, since your GlideRecord includes that.
You could also do this without a Script Include by using a Reference Qualifier that looks more like this:
javascript: 'u_active!=false^business_unit=' + current.u_sbu_ssu;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 04:12 AM - edited 02-14-2025 04:15 AM
Change your return line to
return 'sys_idIN' + departmentList.join(',');
and you don't really need the concatenated part on the Reference Qualifier, since your GlideRecord includes that.
You could also do this without a Script Include by using a Reference Qualifier that looks more like this:
javascript: 'u_active!=false^business_unit=' + current.u_sbu_ssu;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 04:19 AM
no script include required.
Simply use this in advanced ref qualifier
javascript: 'business_unitIN' + current.u_sbu_ssu + '^u_active=true';
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2025 06:49 AM
Did you get a chance to check my above comment?
That should also work and no scripting required.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 04:20 AM
Thank you @Brad Bowman it works wonders!!!