- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 01:51 AM
Hi, I have a variable on a catalogue item that references the sys_user table. I'd like that variable to only show the users that are in the same location as the current user's location (i.e current user is European so he will only see European users). How do I do this with reference qualifier?
I've found a post that resembles this problem, but not entirely. I'm new to ServiceNow, so I don't know yet how to tweak the answer to fit my specific case.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 03:43 AM - edited 11-30-2022 03:46 AM
There is a much easier way to do this, without requiring a script include.
gs.getUser().getLocation() returns the location of the logged in user. In the reference qualifier of your variable, you can use it as follows -
javascript:gs.getUser().getLocation()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 03:20 AM
I am still getting an error even after including the two first lines. What am I doing wrong? Thank you for your patience guys.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 03:30 AM
Hi @JordyZ
Create new SI and make client callable false and refer below
Try this one for new SI and let me know if it is working or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 03:58 AM
Hey @JordyZ
In your code last line was missing. (type: 'populate_users')
I am attaching here xml of script include.
Please check once by importing it.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 02:47 AM
Hello @JordyZ
Please refer attached screenshot for reference. You script include look like :
Reference qualifier :
Please mark my response as Correct / Helpful based on Impact.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 02:51 AM