Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Display inactive users in a Catalog Item (for non-admin users). OOB User query BR

JuanGDev
Tera Contributor

Hi everyone,

I’m working on a catalog item where users should be able to request reactivation of inactive users from the same Business Unit as the Requested For.

Here’s the current setup:

  • requested_for → Reference to sys_user

  • business_unit → Single Line Text, auto-populated via Requested For → Department → Business Unit name

  • deactivate_user_ref → Lookup Select Box, used to display inactive users filtered by Business Unit

What I’ve already tried

 

Lookup Select Box + Script Include

  • Created a client-callable Script Include (GetInactiveUsersByBU) to return inactive users by Business Unit.

  • Added an onChange Client Script on the Business Unit variable to populate the lookup list dynamically.
    Works perfectly for admin users.
    When impersonating non-admin users, the list appears blank (only “None”).

Modified the OOB Business Rule “User Query”

  • Tried adjusting the condition to exclude this specific catalog item using:

gs.getSession().isInteractive() && 
!(gs.hasRole("admin") || gs.hasRole("user_admin")) && 
!gs.action.getGlideURI().toString().includes('sysparm_id=###############)

Didn’t work — the inactive users are still hidden.

The challenge:

 

The root cause is the OOB “User Query” business rule that hides inactive users for interactive sessions unless you’re an admin or user_admin.

If I disable that rule, inactive users appear correctly — but that would have a big side effect, as we’d then need to manually filter out inactive users across other catalog items and references, which isn’t viable long-term.

 

 

-----

The question:

 

What would be the best approach to safely display inactive users to non-admin users in this specific catalog item without disabling or altering the OOB User Query business rule?

5 REPLIES 5

JuanGDev
Tera Contributor

The variable previously used to select inactive users was changed from a Lookup Select Box to a simple Email field.

  • End-users can now manually enter the email address of the inactive user to be reactivated, instead of selecting them from a restricted reference list.