Create view that filters by group
-
18-02-2021 - |
Question
Is it possible in SharePoint Online to have views based on the group the user is a member of? For example, if I assign user 1 to group A, and user 2 to group B, would it be possible for user 1 to see only tasks from a list that have a column that would match group A.
I tried creating a column that accepts "Person or Group", but I don't know how to filter a view for groups. I know that if we want to filter it for a user, we should put [Me]. Is audience targeting a solution? If so, how would I accomplish it?
Solution
The default view filter option doesn't allow filtering on [Group]. However, it might be accomplished by using SharePoint Designer.
You can check out this article.
The key is to add the [Where] clause to the View Filter Query (CAML)
<Membership Type="CurrentUserGroups">
<FieldRef Name="AssignedTo"/>
</Membership>
For audience targeting, you can read here.