- 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
‎08-16-2017 05:29 AM
Hi Sri,
One thing you can do is.
Modify business rule condition so that it doesn't run for itil user.
But this will be a global impact.
Current condition:
gs.getSession().isInteractive() && !gs.hasRole("admin")
Modified Condition:
gs.getSession().isInteractive() && !gs.hasRole("admin") && !gs.hasRole("itil")
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2017 05:38 AM
But i dont want it to be a global impact. I want for that particular form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2017 06:01 AM
If you only want it on a specific variable then you can update the business rule to be:
var restrictQuery = true;
var variableName = "IO:66c334eac0a8016b017e6affe311ebb6"; //change the sysid here for the sysid of the variable you don't want it to be restricted for
if (gs.hasRole("itil")) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_name') != null && map.get('sysparm_name') == variableName) {
restrictQuery = false;
}
}
if (restrictQuery) {
current.addActiveQuery();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2017 01:14 AM
Hi Ahmed,
Nothing is getting displayed if i update BR(user query) as per your code. Also this is getting applicable globally, not getting restricted to only this variable.