Filter WI form UserPicker fields to User class only
Best Answers
-
Geoff_Ross Cireson Consultant O.G.Hi Leigh,
In the setting items is a setting for user and group search filter. It's basically a WHERE clause that will apply to a select on the user and group SQL tables to produce the results. To completely remove any groups from showing, we can set the group filter to a falsy clause (meaning that no rows will be returned from the group table) such as 1 = 0.
This will remove all groups from showing on the work item forms.
HOWEVER, there is a huge gotcha here. That same filter is used on the group only pickers throught the settings such as assigning navigation nodes to AD Groups. With the above in place you cannot set any of these settings so you will need to flip it back to the default temporarily.
Geoff5 -
Tom_Hendricks Customer Super IT Monkey ✭✭✭✭✭You could also create a single object picker control that targets a datasource that does not return groups with the users (a dashboard query using SQL that excludes it like the example above from Geoff), thereby letting the setting item remain untouched and still work the same way for your other user pickers.
The result is essentially the same as a user picker, but it doesn't use the filter from the settings. Normally this would be a very inefficient approach since you already have that query in the settings, but doing this allows your control to act independently of it. If you want all your pickers to behave the same way, I would take the advice from @Geoff_Ross instead of this (much simpler!).
5
Answers
In the setting items is a setting for user and group search filter. It's basically a WHERE clause that will apply to a select on the user and group SQL tables to produce the results. To completely remove any groups from showing, we can set the group filter to a falsy clause (meaning that no rows will be returned from the group table) such as 1 = 0.
This will remove all groups from showing on the work item forms.
HOWEVER, there is a huge gotcha here. That same filter is used on the group only pickers throught the settings such as assigning navigation nodes to AD Groups. With the above in place you cannot set any of these settings so you will need to flip it back to the default temporarily.
Geoff
The result is essentially the same as a user picker, but it doesn't use the filter from the settings. Normally this would be a very inefficient approach since you already have that query in the settings, but doing this allows your control to act independently of it. If you want all your pickers to behave the same way, I would take the advice from @Geoff_Ross instead of this (much simpler!).