- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2020 11:38 PM
Hi,
I have a field Requested on Behalf on a catalog item which is a reference field to the sys_user table. By default, we will be able to see only active users in the Requested field, But I also want to see inactive users in the requested field.
1. One solution for this is to give the user_admin role to a particular user(not the best solution though) and we are not allowed to modify the OOTB business rule as well.
I heard that some business rule is locking the user session to only show active records.. Don't know much abt that.
So how we achieve this? Any help would be massively appreciated..
Thanks!!
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2020 03:32 AM
Thank you ankur and jaspal. I have written and article on this https://community.servicenow.com/community?id=community_article&sys_id=e2f2878bdbd4ec1011762183ca961... . This solves my requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2020 05:06 AM
Hi Jaspal,
URL: https://dev87918.service-now.com/sp?id=sc_cat_item&sys_id=7cb65753db051010dd0a5fc74b961950
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2020 05:17 AM
Thanks. Try below,
var url = gs.action.getGlideURI().toString();
var index = url.toString().indexOf('sys_id=7cb65753db051010dd0a5fc74b961950')>-1;
if (index == false) {
current.addActiveQuery();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2020 10:24 AM
Hi Jaspal,
It's not working.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2020 11:47 AM
For me it works well on portal view as well & version is NewYork.
Anways, you can use below.
1. Variable as below.
2. Update business rule code as below with condition as
gs.getSession().isInteractive() && !(gs.hasRole("admin") || gs.hasRole("user_admin"))
var query = current.getEncodedQuery();
if( gs.getSession().isInteractive() && !query.includes('activeANYTHING') )
{
current.addActiveQuery();
}
3. Make sure you check Setp 2 as non-admin user as for admins the condition is excluded.
Tested the same in PDI & works well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2020 10:12 AM
Hi,
the above would work in native view; for handing in portal some other approach would be required.
this line would lead to issue in portal
var url = gs.action.getGlideURI().toString();
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader