- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2025 04:17 PM
Hi. I'm looking to apply a filter so that non-admins are not able to use the user accounts where [Internal Integration User] is true. I found the oob 'user query' business rule on the sys_user table where the condition is to filter out any inactive users unless you are admins. But I'm not sure how to also apply a filter for the additional field as well.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2025 06:04 PM
Hi @Ore-Jon ,
couple of ways you can achieve this
1. you can create one more query BR on User table without touching the OOB one
script
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (!gs.hasRole('admin'))
current.addQuery('internal_integration_user', false);
})(current, previous);
in case you want to show the internal_integration_user= false users to user_admin roled users too
you can update the script as this
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (!gs.hasRole(['admin', 'user_admin']))
current.addQuery('internal_integration_user', false);
})(current, previous);
OR
2. The OOB query User BR looks for users without admin or user_admin role you have to remove the user_admin role condition on the condition if you just want to show
if your okay show internal integration users to the user_admin roled users update script as below
current.addActiveQuery();
current.addQuery('internal_integration_user', false);
Better go with the first option
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2025 05:46 PM
hi @Ore-Jon ,
Open the existing User Query Business Rule and in the script part, you’ll see logic like:
if (!gs.hasRole('admin')) {
current.addQuery('active', true);
}
To add your new filter, you can extend it like this:\
if (!gs.hasRole('admin')) {
current.addQuery('active', true);
current.addQuery('internal_integration_user', '!=', true);
}
Here, 'internal_integration_user' should be the exact name of your field (check the dictionary name on the sys_user table – it might be something like u_internal_integration_user if it’s a custom field).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2025 06:04 PM
Hi @Ore-Jon ,
couple of ways you can achieve this
1. you can create one more query BR on User table without touching the OOB one
script
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (!gs.hasRole('admin'))
current.addQuery('internal_integration_user', false);
})(current, previous);
in case you want to show the internal_integration_user= false users to user_admin roled users too
you can update the script as this
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (!gs.hasRole(['admin', 'user_admin']))
current.addQuery('internal_integration_user', false);
})(current, previous);
OR
2. The OOB query User BR looks for users without admin or user_admin role you have to remove the user_admin role condition on the condition if you just want to show
if your okay show internal integration users to the user_admin roled users update script as below
current.addActiveQuery();
current.addQuery('internal_integration_user', false);
Better go with the first option
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2025 08:28 PM
@Chaitanya ILCR already shared both the approaches.
Please use and let us know the feedback
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader