Home › Forums › Cascading dropdowns › Cascading Drop down filter by User Group
Tagged: CascadingDropdown
- This topic has 3 replies, 2 voices, and was last updated 4 years, 1 month ago by Alexander Bautz.
-
AuthorPosts
-
-
October 9, 2020 at 15:47 #31860
Good Day!
I was trying to figure out a way to keep my cascading drop downs exactly as they are now with the exception that I only want a few of the options available to only a certain SharePoint Group.
I tried to do a CAML query but even using one simple field it times out (listed below)
<where><eq><fieldref name=’Active’ /><Value Type=’Text’>Yes</value></eq></where>
I was going to work on the membership part after getting this simple one to work but it times out. Is my syntax wrong and is it possible to do what I am looking for?
-
October 9, 2020 at 16:43 #31862
The CAML syntax is case sensitive – try it like this:
<Where><Eq><FieldRef Name='Active' /><Value Type='Text'>Yes</Value></Eq></Where>
Please note that if your “Active” field is yes/no checkbox (boolean) you must do it like this:
<Where><Eq><FieldRef Name='Active' /><Value Type='Boolean'>1</Value></Eq></Where>
You can use the Membership element like described here: https://docs.microsoft.com/en-us/sharepoint/dev/schema/membership-element-query
Alexander
-
October 9, 2020 at 17:05 #31864
Thank you for the fast reply. I have the active part working but still having trouble with the membership
<Where><And> <Eq><FieldRef Name='Active' /><Value Type='Text'>Yes</Value></Eq> <Eq><Membership Type=\"CurrentUserGroups\ "><Value Type='Text'>MIS Reporting Owners</Value></Membership></Eq> </And></Where>
This is assuming the group name is MIS Reporting Owners
-
October 10, 2020 at 09:14 #31872
This is unfortunately not how the Membership check works in CAML. It will only check that you are a member of the group selected in the “Person or Group” field in each list item and not a general check to see if you are member of the group specified in a Value tag.
This means that if you use a query like this:
<Where> <And> <Eq><FieldRef Name='Active' /><Value Type='Text'>Yes</Value></Eq> <Eq><Membership Type='CurrentUserGroups'><FieldRef Name='AssignedTo' /></Membership></Eq> </And> </Where>
You would get back all items where Active = Yes and where the AssignedTo Person or Group field had a SharePoint group where you are member selected.
Depending on what you are trying to do, you can use custom js to check if the logged in user is in a specified group and then invoke different cascading dropdown functions (by building the function call in custom js and not use the cascading dropdown tab in DFFS) – where you use a different query to get the options.
Alexander
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.