Adding a condition to BR user query

oharel
Kilo Sage

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

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee
7 REPLIES 7

top_tanti
Tera Expert

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


Screen Shot 2016-07-17 at 2.10.47 PM.png


Yes, that was my initial thought. However, for some reason, it is not working. I added that exact filter condition and still it shows the person on leave when clicking on the magnifying glass.


onleaveisfalse.JPG


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.


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.