- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2016 01:56 PM
Hi all,
How do I add an "and" condition to the BR user query?
I would like to filter in assigned_to not only inactive users, but also other users who have a certain attribute in their user profile, such as "on leave" (u_on_leave), which is a true/false field.
current.addActiveQuery().addCondition('u_on_leave', false);
seems to make the user with u_on_leave=true vanish from all lists, including from the list of users in sys_user...
Thanks,
Harel
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2016 02:23 PM
Hi Harel,
You may also find below link helpful for reference.
Controlling record access using 'Before Query' business rules - ServiceNow Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2016 02:10 PM
If you're trying to do this for the assigned_to field, you should do it from the dictionary entry record of that field and apply the correct reference qualifier conditions. Doing it in that business rule you mentioned is a before query business rule which means anytime a user (that is not admin) queries the sys_user table, those queries will automatically apply.
In the image below, you would just use the "Add Filter Condition" with parameters of u_on_leave is false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2016 04:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2016 04:15 PM
Where are you testing the functionality - which table? Is there a dictionary override for that table?
Top Tanti
(928) 221-2023
toptanti@gmail.com
Sent from mobile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2016 04:19 PM
That's the assigned_to field on the task table. Dictionary overrides etc are the default. I would rather use your solution than the BR, but I do not understand why it is not working.