Reference qualifier with cilent script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 03:03 AM
I have cost center field (select lookup with reference to cost center table) and project category field (selectbox with manually entered values).
Cost center based on project category.
Example: scent (project category) has 3 cost center. It should only visible instead of showing the whole list.
I need reference qualifier with client script for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 03:12 AM
Hi @AnnamalaiS
as client script is front side and the data are in server side, you will need to call an ajax from the client script and get that information for you.
- Client script calling ajax
- Ajax must be client-callable
- logics to return in script include called by that ajax.
You can get some inspiration in following:
Cheat sheet:
Let me know if this helped you solve your issue or to get you closer to the solution.
PS: you might refer to client script and catalog client script, it does the same thing just client script is for backend and catalog client script for portal/EC...
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 03:20 AM
client script can't be used to set reference qualifier.
You need to use the advanced ref qualifier on that field to filter the Cost Center based on drop down
what did you start with and where are you stuck?
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
07-29-2025 07:05 AM
In cost center field
javascript:'sys_idIN' + new CostCenterMapping().getCostCentersForCategory(current.variables.project_category);
ref_qual_elements=project_category
client script :
script include :
it is not working as expected.
please guide me to solve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 07:08 AM
Hi @AnnamalaiS you have a typo in GlideAjax:
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */