
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 07:03 AM
I have an item in the catalog where I need the end users to be able to select disabled user records.
We currently have the typical before query business rule that limits those disabled records to HR and the Service Desk roles.
I still want to limit to only active users everywhere else. The only exception is this variable.
Is there a way I can avoid running this BR?
I was thinking a script include for an advanced ref qualifier, but I assume that still would trigger that BR.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2018 07:04 AM
Hi Shill,
I've recently encountered the same situation. I solved the problem by setting the reference qualifier on the variable to "activeANYTHING". Inside the "User Query" business rule I do something similar to:
var query = current.getEncodedQuery()
if( gs.getSession().isInteractive() && !query.includes('activeANYTHING') )
current.addActiveQuery()
Hope this helps you or others. Same idea can be used to bypass other query rules.
Ryan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 04:41 AM
Just a heads up,
!query.includes('manager=javascript:gs.getUserID()')
is going to include inactive users on any reference field or variable that contains this filter across your instance, which might be unwanted behaviour.
You can still utilise
!query.includes('activeANYTHING')
by adding "activeANYTHING^" to the start of your variable's reference qualifier so that it reads:
activeANYTHING^manager=javascript:gs.getUserID()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2019 05:28 AM
Quote:
Just a heads up,
!query.includes('manager=javascript:gs.getUserID()')
is going to include inactive users on any reference field or variable that contains this filter across your instance, which might be unwanted behaviour.
Yes, I know, and that is the desired behavior. Note I mentioned in my original question:
Basically, the managers submitting this request should only see employees who report to them (whether active or not).
Actually, most of the time, they will be making submissions for terminated employees for this project (it is a request for access to folders of terminated employees and/or access to their email folders).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2019 02:42 PM
Thanks for this, worked perfectly. Any ideas on how to make a catalog client script then also return values for other variables off of this? The users can choose the inactive users now, but trying to populate other variables is returning undefined.
Thanks
-Chris

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2019 06:18 AM
Hi Chris,
I got around this by adding query condition:
sysUserGR.addQuery('activeANYTHING');
to my sys_user GlideRecord when fetching user values, which causes the "User query" business rule to be bypassed.
On a side note, I had to further adapt the business rule so that 'restricted' values display on the Service Portal ticket page. Our business rule now reads:
var query = current.getEncodedQuery();
var urlOnStack = gs.getUrlOnStack();
// Includes inactive users when "Active is anything" filter is set or when user is on a 'ticket' Service Portal page
if (!query.includes('activeANYTHING') && !urlOnStack.includes('id=ticket'))
current.addActiveQuery();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2021 12:23 PM
Thanks! worked perfectly!