- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2017 05:22 AM
Hi ,
Can anybody know , how can we show inactive users to ITIL users ?
I have a field referring to user table in Catalog item. When ITIL user is clicking on the reference field, he can only see list of active users. I need to show him inactive users as well but the global BR (user query) is restricting the visibility.
I need to show active users + inactive users only for this catalog item.
Let me know if anybody has worked on it.
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:06 AM
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
Originally posted: https://community.servicenow.com/community?id=community_question&sys_id=e62347e1dbd8dbc01dcaf3231f9619d6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2018 02:08 PM
How can you acheive this please : "(in the BR you'd need to check where the user is accessing from)." ?
If you add ITIL to your BR you should update each catalog variable referecing sys_user with an active condition.
What is this catalog item supposed to acheive ? Is there no other way to deal with the customer's need than a catalog item ?
If you keep the user Active and lock him out he will still appear on the list. Would this do the trick ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2018 10:53 PM
User below code to see inactive users for any specific catalog items. use this code in OOB BR (User Query)
(function executeRule(current, previous /*null when async*/) {
//used for the visibility of inactive users in particular items.
var cat_ids = gs.getProperty('property_name');//fetch catalog items sys_id
var cat_id_array = cat_ids.split(',');
var flag=false;
for(var i = 0; i < cat_id_array.length; i++) {
var cat_sysid=cat_id_array[i];
var catItem = GlideTransaction.get().getRequest().getHeader("referer").toString().indexOf(cat_sysid+'');
if(catItem!=-1){ //if the catalog item sysid present in query URL. -1 means no search result
flag=true;
break;
}
}
if(flag) { }
else{
current.addActiveQuery();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2018 07:06 AM
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
Originally posted: https://community.servicenow.com/community?id=community_question&sys_id=e62347e1dbd8dbc01dcaf3231f9619d6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2018 01:13 AM
Thanks Ryan!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 11:23 AM